How to merge subdocuments during aggregation

51 views
Skip to first unread message

stefan....@googlemail.com

unread,
Jun 11, 2014, 4:26:58 AM6/11/14
to mongod...@googlegroups.com
Dear community,

In my aggregation pipeline I would like to change the document
{
  a : { /* all fields of a */ },
  b : { /* all fields of b */ }
}
to
{
  a : { /* all fields of a */ , b : { /* all fields of b */ }}
}

The aggregation stage shall be generic, i.e. without naming the field names of a nor b explicitly (just all fields, the fields are highly volatile from object to object).
The names "a" and "b" of course are available.

Using new features from 2.6 is okay for me.



Asya Kamsky

unread,
Jun 16, 2014, 5:11:53 AM6/16/14
to mongodb-user
Unfortunately, I don't think there is a way to do this with aggregation currently.

You can do it with mapReduce but of course that's much slower and more complicated.

Asya



--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/af241bd4-78e3-4096-8b4d-5fa1cacae4fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages