My query
test.find({ "age" : "20" }, {"email": 1, "_id": 0}).toArray(function (err,data) {
if (err) throw err;
console.log(data);
and result after I run my query
[ { email: 'root@root.com' } ]
How can I save console.log(data);
to an Array or list ? I tried .push(data)
to save but not ok.
Create an empty object and then assign value to it
test.find({ "age" : "20" }, {"email": 1, "_id": 0}).toArray(function (err,data) {
if (err) throw err;
console.log(data);
var obj =[];
var obj = data;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.