如果你知道你可以这样说的话,你就只能问一下。
db.foo.find({ account_profile.discount_pct : 15 })
检查测试数据
> db.foofoo.insert({name: ram ,account_profile : {"Client code": "0123456789", discount_pct : 2}})
> db.foofoo.insert({name: ram ,account_profile : {"Client code": "0123456789", discount_pct : 2}})
> db.foofoo.insert({name: ram ,account_profile : {"Client code": "01236789", discount_pct : 5}})
> db.foofoo.insert({name: ram ,account_profile : {"Client code": "01236789", discount_pct : 2}})
> db.foofoo.insert({name: ram ,account_profile : {"Client code": "01236789", discount % : 2}})
> db.foofoo.insert({name: ram ,account_profile : {"Client code": "01236789", discount_pct : 4}})
> db.foofoo.insert({name: ram ,account_profile : {"Client code": "01236789", discount_% : 4}})
> db.foofoo.insert({name: ram ,account_profile : {"Client code": "01236789", discount_% : 2}})
> db.foofoo.find({ account_profile.discount_% : 2})
{ "_id" : ObjectId("4eb0c9965325a7760cfda3db"), "name" : "ram", "account_profile" : { "Client code" : "01236789", "discount_%" : 2 } }
> db.foofoo.find({ account_profile.discount_pct : 2})
{ "_id" : ObjectId("4eb0c9725325a7760cfda3d5"), "name" : "ram", "account_profile" : { "Client code" : "0123456789", "discount_pct" : 2 } }
{ "_id" : ObjectId("4eb0c97c5325a7760cfda3d7"), "name" : "ram", "account_profile" : { "Client code" : "01236789", "discount_pct" : 2 } }
由于上述,,你有时间。 外地名称,因为它代表了公证。