I am trying to merge a set of documents into a collection A
{'s': 'v1', 'id': 1}
{'s': 'v2', 'id': 2}
{'s': 'v3', 'id': 3}
{'s': 'v4', 'id': 4}
into a unique document of key value pairs as fallow.
{
'v1': 1,
'v2': 2,
'v3': 3,
'v4': 4
}
Could you suggest a way to do that using a unique MongoDB command without persisting data in another collection?