I'm using NodeJS with Mongoose. I have a collection 'user' with a schema like the following:
id: String
name: String
surname: String,
otherField1: Number,
otherFieldN: String,
arrayField: [String],
messages:[
{
date: SchemaTypes.Long,
id: String,
type: String,
content: String
}
],
status:String
I precise that in the second case (more queries), depending on the result of the first queries will change the fields needed by the succeeding ones