1
值我有MongoJS查詢電話:如何選擇MongoJS查詢輸出
db.users.find({username:"eleeist"},function(err, docs) {
console.log(docs);
});
的docs
變量看起來像這樣在控制檯輸出:
[ { _id: 4fee05662b17f88abbeb60b6,
username: 'eleeist',
password: 'test' } ]
我想顯示的密碼用戶eleeist
。
我試過docs.password
但得到可怕的錯誤。
那麼如何從返回的查詢結果中選擇值呢?