node.js - How to select value from MongoJS query output -
i have mongojs query call:
db.users.find({username:"eleeist"},function(err, docs) { console.log(docs); });
the docs
variable looks in console output:
[ { _id: 4fee05662b17f88abbeb60b6, username: 'eleeist', password: 'test' } ]
i display password of user eleeist
.
i tried docs.password
awful errors.
so how select values returned query result?
docs
array of documents, password of first 1 you'd use docs[0].password
.
Comments
Post a Comment