db.weike.findOne({ "_id" : ObjectId("5757dc9387c523796d7778af"), }).phones .forEach( function(ref){ printjson(db[ref.$ref].findOne({"_id":ObjectId(ref.$id)})); })
只能显示关联的部分 不知道还有没有更好的方法
db.weike.findOne({ "_id" : ObjectId("5757dc9387c523796d7778af"), }).phones .forEach( function(ref){ printjson(db[ref.$ref].findOne({"_id":ObjectId(ref.$id)})); })
只能显示关联的部分 不知道还有没有更好的方法
Tags mongodb
MongoDB除了基本的查询功 ...