Is there a way to run MongoDB shell (or tojson method) in strict JSON mode?

后端 未结 1 1600
余生分开走
余生分开走 2021-01-19 01:14

Is there a way to run MongoDB shell (or particular tojson method) in strict JSON mode?

Why I need this - To be able take the output of shell (generated by some js co

相关标签:
1条回答
  • 2021-01-19 01:32

    Workaround: you can start Mongo in REST mode and the REST mode does return strict JSON. Not sure if you can access REST through the shell but it would solve your problem.

    Technically there is only strict JSON, so if the to_json() method is generating invalid JSON output then I would file a bug at https://jira.mongodb.org/secure/Dashboard.jspa

    In addition, if you would give an example of what you are trying to output using to_json() then people might be able to offer you more specific help.

    0 讨论(0)
提交回复
热议问题