我想获取我的收藏数据,我的收藏已命名,并且是我的数据库的一部分。studentspool
与 mongoDB 的连接工作正常,但返回 。console.log(result.lastname)undefined
这是我的文件server.js
var mongo = require('mongodb');
var assert = require('assert');
const url = 'mongodb://localhost:27017/';
mongo.connect(url, function (err, db) {
if(err) {
console.log("Connection failed");
}
console.log("Connection successfull");
var dbo = db.db("pool");
dbo.collection("students").find({}, function(err, result) {
if (err) throw err;
console.log(result.lastname);
db.close();
});
});
以及我直接在控制台中看到的我的收藏中的内容studentsdb.students.find();
{ "_id" : ObjectId("5eb1570f2c0167c90cc127fd"), "id" : 0, "lastname" : "Sam", "firstname" : "Sung", "email" : "sc@mail.com", "phone" : 613295990, "validated" : "Validated", "admin" : true }
慕村225694
千万里不及你
相关分类