[MongoDB] Checking for Array Field Element Existence
Tadashi Shigeoka · Thu, February 6, 2014
I’ll introduce the condition for checking if elements exist in array fields in MongoDB.
The key point is the condition ‘arrayFieldName.0’ : { $exists: true }.
db.users.find({'friends.0': {$exists: true}})
When I write this occasionally, I think “Hmm? How do I write this again?”
Reference Information
That’s all from the Gemba.
