Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

$out in mongodb

Takes the documents returned by the aggregation pipeline and writes them 
to a specified collection. The $out operator must be the last stage in 
the pipeline. The $out operator lets the aggregation pipeline return result 
sets of any size.


db.getSiblingDB("test").books.aggregate( [
    { $group : { _id : "$author", books: { $push: "$title" } } },
    { $out : "authors" }
] )

Source by www.mongodb.com #
 
PREVIOUS NEXT
Tagged: #mongodb
ADD COMMENT
Topic
Name
6+3 =