code: function documentToObject(document, adapterName) {
    expect(arguments).to.have.length(
      2,
      'Invalid arguments length when converting a MongoDB document into ' +
      'an entity object (it has to be passed 2 arguments)'
    );
  
    var obj = {};
  
    // replace `_id` with `id`
    if (document.hasOwnProperty('_id')) {
      obj.id = document._id;
    }
  
    // get document class
    var EntityClass = Entity.getSpecialization(document.Entity);
  
    // loop through entity's attributes and replace with parsed values
    var attributes = EntityClass.attributes;
    for (var attrName in attributes) {
      if (attributes.hasOwnProperty(attrName)) {
        // get attribute name in database
        var attr = attributes[attrName];
        var dataName = attr.getDataName(adapterName);
        // check if name is present on document and replace with parsed value
        if (document.hasOwnProperty(dataName)) {
          obj[attrName] = attr.parseDataValue(document[dataName]);
        }
      }
    }
  
    return new EntityClass(obj);
  }
docs: Converts a MongoDB document to an Entity object.
  @name module:back4app-entity-mongodb.MongoAdapter#documentToObject
  @function
  @param {Object.<string, *>} document The MongoDB document.
  @param {String} adapterName The name of the entity adapter.
  @returns {!module:back4app-entity/models.Entity} The converted Entity object.
  @example
  <pre>
  var myEntity = mongoAdapter.documentToObject(myDocument, 'mongo');
  </pre>