2015-02-11 30 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

回答