src/back/MongoAdapter.js
function loadEntity(Entity) {
    expect(arguments).to.have.length(
      1,
      'Invalid arguments length when loading an entity in a ' +
      'MongoAdapter (it has to be passed 1 argument)'
    );

    expect(Entity).to.be.a(
      'function',
      'Invalid argument "Entity" when loading an entity in a ' +
      'MongoAdapter (it has to be an Entity class)'
    );

    expect(classes.isGeneral(entity.models.Entity, Entity)).to.be.equal(
      true,
      'Invalid argument "Entity" when loading an entity in a ' +
      'MongoAdapter (it has to be an Entity class)'
    );

    expect(Entity.dataName).to.not.equal(
      '',
      'The dataName of an Entity cannot be an empty string in a MongoAdapter'
    );

    expect(Entity.dataName).to.not.match(
      /^system\./,
      'The dataName of an Entity cannot start with "system." in a MongoAdapter'
    );

    expect(Entity.dataName).to.not.contain(
      '$',
      'The dataName of an Entity cannot contain "$" in a MongoAdapter'
    );

    expect(Entity.dataName).to.not.contain(
      '\0',
      'The dataName of an Entity cannot contain "\0" in a MongoAdapter'
    );

    expect(_collections).to.not.have.ownProperty(
      Entity.dataName,
      'Failed to load the Entity called "' + Entity.specification.name +
      '" because it is not possible to have Entities with duplicated ' +
      'dataName in a MongoAdapter'
    );

    _collections[Entity.dataName] = [];
  }
function loadEntity(Entity) {
    expect(arguments).to.have.length(
      1,
      'Invalid arguments length when loading an entity in a ' +
      'MongoAdapter (it has to be passed 1 argument)'
    );

    expect(Entity).to.be.a(
      'function',
      'Invalid argument "Entity" when loading an entity in a ' +
      'MongoAdapter (it has to be an Entity class)'
    );

    expect(classes.isGeneral(entity.models.Entity, Entity)).to.be.equal(
      true,
      'Invalid argument "Entity" when loading an entity in a ' +
      'MongoAdapter (it has to be an Entity class)'
    );

    expect(Entity.dataName).to.not.equal(
      '',
      'The dataName of an Entity cannot be an empty string in a MongoAdapter'
    );

    expect(Entity.dataName).to.not.match(
      /^system\./,
      'The dataName of an Entity cannot start with "system." in a MongoAdapter'
    );

    expect(Entity.dataName).to.not.contain(
      '$',
      'The dataName of an Entity cannot contain "$" in a MongoAdapter'
    );

    expect(Entity.dataName).to.not.contain(
      '\0',
      'The dataName of an Entity cannot contain "\0" in a MongoAdapter'
    );

    expect(_collections).to.not.have.ownProperty(
      Entity.dataName,
      'Failed to load the Entity called "' + Entity.specification.name +
      '" because it is not possible to have Entities with duplicated ' +
      'dataName in a MongoAdapter'
    );

    _collections[Entity.dataName] = [];
  }
function loadEntity ( Entity ) { expect ( arguments ) . to . have . length ( 1 , 'Invalid arguments length when loading an entity in a ' + 'MongoAdapter (it has to be passed 1 argument)' ) ; expect ( Entity ) . to . be . a ( 'function' , 'Invalid argument "Entity" when loading an entity in a ' + 'MongoAdapter (it has to be an Entity class)' ) ; expect ( classes . isGeneral ( entity . models . Entity , Entity ) ) . to . be . equal ( true , 'Invalid argument "Entity" when loading an entity in a ' + 'MongoAdapter (it has to be an Entity class)' ) ; expect ( Entity . dataName ) . to . not . equal ( '' , 'The dataName of an Entity cannot be an empty string in a MongoAdapter' ) ; expect ( Entity . dataName ) . to . not . match ( / ^system\. / , 'The dataName of an Entity cannot start with "system." in a MongoAdapter' ) ; expect ( Entity . dataName ) . to . not . contain ( '$' , 'The dataName of an Entity cannot contain "$" in a MongoAdapter' ) ; expect ( Entity . dataName ) . to . not . contain ( '\0' , 'The dataName of an Entity cannot contain "\0" in a MongoAdapter' ) ; expect ( _collections ) . to . not . have . ownProperty ( Entity . dataName , 'Failed to load the Entity called "' + Entity . specification . name + '" because it is not possible to have Entities with duplicated ' + 'dataName in a MongoAdapter' ) ; _collections [ Entity . dataName ] = [ ] ; }
Registers the Entity on Adapter's Collection Dictionary, if valid.
@name module:back4app-entity-mongodb.MongoAdapter#loadEntity
@function
@param {!module:back4app-entity/models/Entity} Entity The Entity Class
to be validated and added to Adapter's Collection dictionary.
@example
Entity.adapter.loadEntity(Entity);
Registers the Entity on Adapter s Collection Dictionary if valid .