Basics of MongoDB Scripts - How to

后端 未结 3 424
春和景丽
春和景丽 2021-02-01 18:41

What are the basics of MongoDB Scripts?

I think the script will end with .js, and we run it using mongo try.js

But if I put

<         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-02-01 18:50

    There's a built-in function for printing a json object.

    Just append .forEach(printjson) to the end of the function call.

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

提交回复
热议问题