code: function objectToDocument(entityObject, onlyDirty) {
    expect(arguments).to.have.length.below(
      3,
      'Invalid arguments length when converting an entity object in a ' +
      'MongoDB document (it has to be passed less than 3 arguments)'
    );
  
    expect(entityObject).to.be.an.instanceOf(
      Entity,
      'Invalid argument "entityObject" when converting an entity object in a ' +
      'MongoDB document (it has to be an Entity instances)'
    );
  
    if (onlyDirty) {
      expect(onlyDirty).to.be.a(
        'boolean',
        'Invalid argument "onlyDirty" when converting an entity object in a ' +
        'MongoDB document (it has to be a boolean)'
      );
    }
  
    var document = {};
  
    var entityAttributes = entityObject.Entity.attributes;
  
    for (var attributeName in entityAttributes) {
      if (!onlyDirty || entityObject.isDirty(attributeName)) {
        var attribute = entityAttributes[attributeName];
        var attributeDataName = attribute.getDataName(entityObject.adapterName);
        var attributeDataValue = attribute.getDataValue(
          entityObject[attributeName]
        );
        document[attributeDataName] = attributeDataValue;
      }
    }
  
    document.Entity = entityObject.Entity.specification.name;
  
    if (!onlyDirty) {
      document._id = entityObject.id;
    }
  
    delete document.id;
  
    return document;
  }
docs: Converts an Entity object in a MongoDB document.
  @name module:back4app-entity-mongodb.MongoAdapter#objectToDocument
  @function
  @param {!module:back4app-entity/models.Entity} entityObject The Entity object
  to be converted to a MongoDB document.
  @param {?boolean} [onlyDirty=false] Sets if only dirty attributes will be
  added to the document.
  @returns {Object.<string, *>} The MongoDB document that is a dictionary.
  @example
  var myDocument = mongoAdapter.objectToDocument(myObject);