Reputation: 1587
Let's say I have the following two documents:
{ "_id" : ObjectId("5d1faa57a370cc52f0614313"), "bucket" : [ [2, 3], [ 111, 111 ]]}
{ "_id" : ObjectId("6d1faa57a370cc52f0614311"), "bucket" : [ [2, 3], [ 999, 999 ]]}
Both documents share the [2,3]
value on the bucket field
.
How can I retrieve such documents from a mongodb collection? Is this even possible?
Sorry if the question is stupid, I'm a mongo newbie.
Upvotes: 0
Views: 40
Reputation: 52
That's possible. You just need to pass the matching argument inside find().
db.getCollection('test').find({"bucket" :[2,3]})
I have provided an image link for your reference.
Upvotes: 1