Export mongodb aggregation framework result to a new collection

前端 未结 3 1439
心在旅途
心在旅途 2020-12-03 00:01

I want to save the aggregation framework result to a new collection. I know that\'s impossible with the framework at the moment with the command itself.

Is there a w

3条回答
  •  感情败类
    2020-12-03 00:20

    Starting with Mongo 2.6.0 you can do this natively without any additional manipulation.

    db..aggregate( [
         {  },
         {  },
         ...,
         { $out : "" }
    ] )
    

    Check the new aggregation operator $out for more detailed example.

    P.S. using this way you are not limited to 16Mb size.

提交回复
热议问题