Reshape all the documents in the collection
问题 I have the following structure in my documents: { "_id" : 1, "item" : { "name" : "abc", "price" : 10, "quantity" : 2, "date" : ISODate("2014-03-01T08:00:00Z") } } And I want to transform each document on this: { "_id" : 1, "name" : "abc", "price" : 10, "quantity" : 2, "date" : ISODate("2014-03-01T08:00:00Z") } In other words remove the embedded document but not the details! Thanks! 回答1: You can use the aggregation especially the $projectoperator for that. The $out operator let you write the