【发布时间】:2010-11-24 05:26:02
【问题描述】:
我是 mongoDB 的新手。我在网络应用程序中使用 mongoDB。
我想知道如何获取文档内部文档属性的值。
假设我的 JSON 是这样的,
{ "_id" : { "$oid" : "4ceb753a70fdf877ef5113ca"}, "Attrr1" : "value1", "Attr2": {"innerAttr1":"innerValue1", "innerAttr2":"innerValue2"}, "Attr3" : { "innerAttr3" : "innerValue3", "innerAttr4" : "innerValue4"} }
对于上面的json,我怎样才能得到innerValue1和innerValue1和innerValue2。
我试过了,但它不适合我!!!
BasicDBObject innerQuery = new BasicDBObject();
field.put("Attr2.innerAttr1", 1);
任何建议都将不胜感激!!!
谢谢
【问题讨论】: