0
在这里,在下面的代码我试图登录一个获取文档,但整个文件内容查询个人场logged..what可能是可行的解决方案..使用MongoDB的
var findDocuments = function(db, callback) {
var collection = db.collection('DATA');
collection.find({'borough':'Bronx'}).toArray(function(err, docs) {
assert.equal(err, null);
console.log("Found the following records");
console.log(docs);
callback(docs);
});
}
output :
[ { _id: 57a47c4a0d0c207a3e0efcc9,
address:
{ building: '1007',
coord: [Object],
street: 'Morris Park Ave',
zipcode: '10462' },
borough: 'Bronx',
cuisine: 'Bakery',
grades: [ [Object], [Object], [Object], [Object], [Object] ],
name: 'Morris Park Bake Shop',
restaurant_id: '30075445' }
]
使用项目获取单个字段输出。由于您通过'borough'字段查询,它会返回与查询匹配的记录。如果只想获取特定字段,那么项目 – jerry
您只想检索特定字段? – Shrabanee
我想要获取只有自治市镇领域 – Manoj