File write operations in mongo script?

后端 未结 6 1562
执念已碎
执念已碎 2020-12-07 22:22

Is this possible to write the query result to the file from mongo js script. I have searched a lot, but I didn\'t find any solution.

ex:-

cursor = db         


        
6条回答
  •  囚心锁ツ
    2020-12-07 23:11

    You can skip the while loop using forEach():

    db.users.find().forEach(printjson);
    

提交回复
热议问题