I’ve got a collection where items look as follows:
{"_id":{"$oid":"5ec7cfa44aead20ddc9b785e"}, "name":"Course 1", "users":[ {"$ref":"user","$id":{"$oid":"5eb0d50b564ded7137aa5472"}}, {"$ref":"user","$id":{"$oid":"5ffefrf9735a14d92480c46"}}, {"$ref":"user","$id":{"$oid":"626dedfrg556d48db6d1b95"}} ]}
How do I query for this item by users’ user id (oid)? I’m using collection.find()
but no combination of queries seems to return anything. Finding by the name works perfectly (eg. collection.find("name": "Course 1")
.
Any help would be much appreciated.