您好,我有这样的 json 数据:
{
"_id":ObjectId('5dfe907f80580559fedcc9b1'),
"companyMail":"mail@gmail.com"
"workers":[
{
"name":name,
"surName":surname,
"mail":"mail2@gmail.com",
"password":"password",
"companyMail":"mail@gmail.com",
}
]
}
我想从工人那里得到一个工人:
{
"name":name,
"surName":surname,
"mail":"mail2@gmail.com",
"password":"password",
"companyMail":"mail@gmail.com",
}
我正在写这个查询:
collection.findOne({
'companyMail':"mail@gmail.com",
'workers.mail':"mail2@gmail.com",
});
但它给了我全部的数据。我只想得到我搜索的工人。我怎么能用 Mongo Dart 做到这一点。 https://pub.dev/packages/mongo_dart