[MongoDB] Checking for Array Field Element Existence
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?”
That’s all from the Gemba.