Mongodb: db.collection.copyTo() and eval() have been deprecated. What's the alternatives?

后端 未结 3 1253
猫巷女王i
猫巷女王i 2021-02-07 02:44

I find that db.collection.copyTo() and eval() have been deprecated since 3.0. But I do not find what can be instead.

What\'s the alternatives?

3条回答
  •  臣服心动
    2021-02-07 02:57

    For a server-side solution you can use aggregation...

    db.getCollection('source')
        .aggregate([
            { $out: 'destination' }
        ]);
    

提交回复
热议问题