1

[when I don't use pretty method it is showing output correctly but in single line][Can anyone help me? thank you in advance]

pratik jaiswal
  • 1,508
  • 3
  • 23
  • 48
  • 1
    You're running this in python not on the mongodb shell, right? Note that the pymongo cursor class (http://api.mongodb.com/python/current/api/pymongo/cursor.html) is different from the MongoDB shell cursor object (https://docs.mongodb.com/manual/reference/method/js-cursor/). It doesn't have a pretty() method. It wouldn't make much sense for it to have it. – tfogo Aug 19 '17 at 19:40
  • 1
    If you're looking for a way to pretty print JSON from python, this answer will help: https://stackoverflow.com/questions/12943819/how-to-prettyprint-a-json-file – tfogo Aug 19 '17 at 19:41

0 Answers0