如何在node.js中将bson转换为json?
我正在检查两个不同的obj之间的区别,这显示了一个错误,因为它需要JSON。 (来自Mongodb的数据传输)
我正在使用下面的链接fast-json-patch,但它无效。
i am using this for bson to json
var job = objjob;
var job2 = objreq;
var delta = diffpatcher.diff(job ,job2 );
console.log(delta);
JOB1以下数据:我想比较工作1和工作2
[ { name: 'Tape',
cost: 10,
datetime: 2016-12-29T14:28:06.846Z,
update_by: '',
_id: 58651d762cd7d2f00cc2de26,
image_path: null },
{ name: 'Wire',
cost: 100,
datetime: 2016-12-29T14:28:06.845Z,
update_by: '',
_id: 58651d762cd7d2f00cc2de24,
image_path: null } ]
JOB 2 ..
[ { image_path: null,
_id: '58651d762cd7d2f00cc2de26',
update_by: '',
datetime: '2016-12-29T14:28:06.846Z',
cost: 10,
name: 'Tape',
id: '58651d762cd7d2f00cc2de26' },
{ image_path: null,
_id: '58651d762cd7d2f00cc2de24',
update_by: '',
datetime: '2016-12-29T14:28:06.845Z',
cost: 100,
name: 'Wire',
id: '58651d762cd7d2f00cc2de24' } ]