What is a Mongoose model property that contains 'ref' but does not specify type? What is a Mongoose model property that contains 'ref' but does not specify type? mongoose mongoose

What is a Mongoose model property that contains 'ref' but does not specify type?


The answer was that the model schemas do not stand on their own, but are passed to a model "factory", which gives them the property types they need.

Thus from that factory the following snippet (below). I looked into the documentation for mongoose-autopopulateand I don't see what autopopulate=truemeans.

new: function(name, properties, statics, methods, schemaMods) {// Add default definition to properties with references and load reference schemasObject.keys(properties).forEach(function(key) {  var modifiedProperty = (property) => {    if (property.ref) {      property.autopopulate = true;      property.type = mongoose.Schema.Types.ObjectId;    }    return property;  };  if (Array.isArray(properties[key]) && properties[key].length === 1) {    properties[key][0] = modifiedProperty(properties[key][0]);  } else {    properties[key] = modifiedProperty(properties[key]);  }});