I'm working with Node.js and MongoDB, I used this line:db.collection('users').insertOne({"name":"john", "password":"connor"}) to insert a new document, and now I'd like to get the password from it.
I tried with: var users_array = db.collection('users').find({name:"john"},{password:true, _id:false}).toArray() and I get an array that looks like this: [{"password":"connor"}]
Any way to get that value and save it in a string or something similar?
var pwString = yourArray[0].passwordfindOne()asvar password = db.collection('users').findOne({name:"john"},{password:true, _id:false}).password