Mongo Shell - Console/Debug Log

后端 未结 2 800
囚心锁ツ
囚心锁ツ 2021-01-31 01:07

Probably a dumb question. Experimenting with Mongo shell.

I want to do something like:

matt@linuxvm:~/mongodb-linux-i686-1.2.3/bin$ ./mongo
MongoDB shell         


        
2条回答
  •  情话喂你
    2021-01-31 01:32

    I usually use scripts when interacting with the shell, so I wrote a basic Logging object that I "load(script)" into the shell, and then use the Logging object to call logging levels (debug,info,warn,error). The Logger object does use 'print' and 'printjson' at it's core. Also, it contains a basic sprintf, padding, record formatting, etc. If you are going to be doing any signifigant amount of script work with mongodb, I recommend this route. Debugging mongodb scripts feels like being back at intro to programming and debugging with print statements. Configurable logging makes this a little better, but I really miss being able to step through the code.

提交回复
热议问题