美文网首页
mongoDB $out (aggregation)

mongoDB $out (aggregation)

作者: Yves_lau | 来源:发表于2016-06-13 15:42 被阅读124次

    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 framework return result sets of any size.

    refrences [https://docs.mongodb.com/manual/reference/operator/aggregation/out/]

     db.Product.aggregate({"$match":{price:10.11,comments:"Good!"}},{"$out":"outProduct"})
    > show tables
    Product
    orders
    outProduct
    system.indexes
    > db.outProduct.find()
    { "_id" : ObjectId("57063058e70eccec158b4567"), "name" : "A foo bar", "price" : 10.11, "did" : NumberLong(44), "comments" : "Good!" }
    { "_id" : ObjectId("57172e93e70ecc86538b4567"), "name" : "A foo bar", "price" : 10.11, "did" : NumberLong(82), "comments" : "Good!" }
    

    相关文章

      网友评论

          本文标题:mongoDB $out (aggregation)

          本文链接:https://www.haomeiwen.com/subject/oxpydttx.html