Export mongodb aggregation framework result to a new collection

前端 未结 3 1430
心在旅途
心在旅途 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:37

    result.result is no longer working, try toArray().

    var result  = db.coll.aggregate(...);
    db.bar.insert(result.toArray());
    

提交回复
热议问题