我有数组的子文档" fan_array"包含id和is_blocked字段。我想检查给定的id是否仅存在于聚合管道中的fan_array中。
示例文档
{
"_id" : ObjectId("599edbef4942810edf6ff9ad"),
"name" : "irfan khan",
"email" : "work.irfan99@gmail.com",
"password" : "$2a$10$lJfN4BAxvzag1/6OvR8IuearPjBoaq6PLwNNV9eBZF97dJGnHE1o2",
"username" : "irfan",
"profile_pic" : "irfan.jpg",
"updated_at" : ISODate("2017-08-24T14:00:15.517Z"),
"created_at" : ISODate("2017-08-24T14:00:15.517Z"),
"is_blocked" : 2,
"notification_setting" : [],
"user_type" : 1,
"is_user_active" : 1,
"__v" : 0,
"fan_array" : [
{
"id" : "599edc7d4942810edf6ff9b4",
"is_blocked" : 1
},
{
"id" : "599edc7d4942810edf6ff9b1",
"is_blocked" : 2
},
{
"id" : "599edc7d4942810edf6ff9b2",
"is_blocked" : 1
}
],
"fanLength" : 13
}