2015-02-11 28 views
0

我有N个对象,我想合并它们。 在我的情况下,我确定不会有任何碰撞。如何在mongo shell中合并对象?

我:

var a = {'name': 'Freeman'} 
var b = {'email': '[email protected]'} 

,我需要:

c => {'name': 'Freeman', 'email': '[email protected]'} 

有一个聪明的办法来做到这一点?

在此先感谢!

花絮:我想合并这些对象而减少工作

+0

看看这个['link'](http://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects-dynamically) – 2015-02-11 15:09:07

回答