Javascript Stringify不会Stringify虚拟填充对象

Javascript Stringify不会Stringify虚拟填充对象,javascript,json,node.js,express,ejs,Javascript,Json,Node.js,Express,Ejs,这是传递给视图的我的对象: app.get('/view_add_requests', isLoggedIn, function (req, res) { var my_id = req.user._id; // this is the senders id & id of logged in user FriendReq.find({to_id: my_id}).populate('profile').exec( function (err, result)

这是传递给视图的我的对象:

app.get('/view_add_requests', isLoggedIn, function (req, res) {
     var my_id = req.user._id;  // this is the senders id & id of logged in user


     FriendReq.find({to_id: my_id}).populate('profile').exec( function (err, result) {
             if(err) res.send(err);

             res.render('view_add_requests', { result : result });
     });
})
[ { _id: 59625cbb2e9f1b7cdc968666,
from_id: '59625cb52e9f1b7cdc968664',
to_id: '59625caf2e9f1b7cdc968662',
msg: 'Hi ! I would like to be your friend!',
__v: 0,
profile2: null,
profile: [ [Object] ],
id: '59625cbb2e9f1b7cdc968666' } ]
在视图中打印

{ _id: 59625cbb2e9f1b7cdc968666, from_id: '59625cb52e9f1b7cdc968664', to_id: '59625caf2e9f1b7cdc968662', msg: 'Hi ! I would like to be your friend!', __v: 0, profile2: null, profile: [ { _id: 59625cb52e9f1b7cdc968665, about: 'null', status: 'Happy', picture: 'https://scontent.xx.fbcdn.net/v/t1.0-1/p200x200/17361955_10208706527529679_1126407854127685629_n.jpg?oh=a4fc39a10fed1abf09bf526046aaa671&oe=5A038BFC', work: 'Duopod Design Limited', language: 'Hindi', relationship_status: 'Single', interested_in: 'female', location: 'Auckland, New Zealand', birthday: '03/28/1993', gender: 'male', name: 'Andy Karwal', id: '10209588148249646', __v: 0, user_id: [Object] } ], id: '59625cbb2e9f1b7cdc968666' }
在控制台的路径中。它打印的日志(结果):

app.get('/view_add_requests', isLoggedIn, function (req, res) {
     var my_id = req.user._id;  // this is the senders id & id of logged in user


     FriendReq.find({to_id: my_id}).populate('profile').exec( function (err, result) {
             if(err) res.send(err);

             res.render('view_add_requests', { result : result });
     });
})
[ { _id: 59625cbb2e9f1b7cdc968666,
from_id: '59625cb52e9f1b7cdc968664',
to_id: '59625caf2e9f1b7cdc968662',
msg: 'Hi ! I would like to be your friend!',
__v: 0,
profile2: null,
profile: [ [Object] ],
id: '59625cbb2e9f1b7cdc968666' } ]

<%= JSON.stringify(result) %> 
Stringify似乎忽略了嵌套对象。如何在视图中访问它? parse(result)返回一个
**错误:JSON中的意外标记位于位置2**
我试过:

<%- result._id %> <%- result.profile[0].name %> <%- result["_id"] %>

所有返回未定义。如何访问“配置文件”中的虚拟填充字段,即名称、图片等?请引导。

我用

JSON.stringify()
仅包括非函数的可枚举属性。我建议检查有问题的财产的可枚举性。还有,什么是“虚拟填充字段”?你能用实际的Javascript术语和定义来描述它们吗?我猜出来了。我没有考虑父数组>>