I want to find a collection from below, with email condition: Below is my collections:
{
"_id" : ObjectId("59265694165bc936e998e314"),
"registrationToken" : null,
"temporaryInvitationId" : null,
"local" : {
"password" : "$2a$10$xkNapVoNInR.FcGOqV4CjKYKV2hCWBzYIoufrFf2",
"email" : "abc@gmail.com"
},
"__v" : 0,
"passwordResetToken" : null,
"profile" : {
"referralId" : "r18YCPsgW",
"_id" : ObjectId("597b7403aca04d1968823668"),
"dietaryPreferences" : [ ],
"referrerId" : "By2b4eKUb",
"percentCommission" : 5
},
"lastLogin" : ISODate("2017-12-21T17:49:46.434Z")
},
{
"_id" : ObjectId("59265694165bc936e998e323"),
"registrationToken" : null,
"temporaryInvitationId" : null,
"local" : {
"password" : "$2a$10$xkNapVoNInR.FcGOqV4CjKYKV2hCWBzYIoufrFf2",
"email" : "xyz@gmail.com"
},
"__v" : 0,
"passwordResetToken" : null,
"profile" : {
"referralId" : "r18YCPsgW",
"_id" : ObjectId("597b7403aca04d1968823669"),
"dietaryPreferences" : [ ],
"referrerId" : "By2b4eKUb",
"percentCommission" : 5
},
"lastLogin" : ISODate("2017-12-21T17:49:46.434Z")
}
I am using below query:
db.users.find( { "local": { email: "abc@hotmail.com" } } ).pretty()
But not able to get result. Please suggest what to do for get result if email is equal to 'abc@gmail.com'.
Thanks in advance