Posts

Showing posts with the label data validation

MongoDB query sample: using $unwind

This is the sample collection I am using in this example: db.getCollection('testCol').find({}).pretty() {     "_id" : ObjectId("59764121cd6857bf00a34809"),     "a" : 1,     "b" : 1 } {     "_id" : ObjectId("59764126cd6857bf00a3480a"),     "a" : 2,     "b" : 2 } {     "_id" : ObjectId("5976412ccd6857bf00a3480b"),     "a" : 3,     "b" : 3 } {     "_id" : ObjectId("59764294cd6857bf00a3480c"),     "a" : 4,     "b" : 4,     "arr" : [         {             "a" : 6,             "b" : 6         },         {             "a" : 7,             "b" : 7         }     ] } This will give me the number of element inside of the arr...