I need the document in a collection that has the least array size of a field among all. Document looks as follows:
{
"_id": ObjectId("jsd273rsdjkvn847ckjnas74"),
"associatedUsers": [
ObjectId("jsd273rsdjkvn847ckjnas75"),
ObjectId("jsd273rsdjkvn847ckjnas76")
]
}
Out of all the documents in MongoDB, I need to find the one with least number of associatedUsers in its array. Basically the one with shortest array length.