[
{
"_id":"5ba8e3c7433cd30be05538b7",
"createdAt":"2018-09-24T07:29:16.188Z",
"subscription":[
{
"types":"Basic",
"registeredOn":1542969566953,
"expires":1545561566953
} {
"types":"Utility",
"registeredOn":1542985801375,
"expires":1545577801375
},
{
"types":"Demo",
"registeredOn":1542985801375,
"expires":1545577801375
}
]
}
]
如何从“订阅”中的许多类型访问具有“ Demo”订阅类型的用户。
答案 0 :(得分:0)
尝试这种方式:
User.find({"subscription.types": "Demo"},function(err,users){
if(!err && users){
return res.json(users);
}
});