我以这种方式将jongoose docs作为json返回:
UserModel.find({}, function (err, users) {
return res.end(JSON.stringify(users));
}
Run Code Online (Sandbox Code Playgroud)
但是,用户.__ proto__也被退回了.没有它我怎么能回来?我尝试了这个,但没有奏效:
UserModel.find({}, function (err, users) {
return res.end(users.toJSON()); // has no method 'toJSON'
}
Run Code Online (Sandbox Code Playgroud)