Using mongo v2.4.5 shell, db.col.find().pretty() does not pretty print for me on either osx console or linux ubuntu 12.04 bash.
There is no diff in the output with and without pretty()
> db.people.find()
{ "_id" : ObjectId("520d293752cfe6ece5d3fd77"), "name" : "Andrew" }
{ "_id" : ObjectId("520e448b77803f8f15fcfedb"), "name" : "Amy" }
>
> db.people.find().pretty()
{ "_id" : ObjectId("520d293752cfe6ece5d3fd77"), "name" : "Andrew" }
{ "_id" : ObjectId("520e448b77803f8f15fcfedb"), "name" : "Amy" }
>
What am I missing? (something crazy basic no doubt)
Thx
UPDATE: doh! answered below. I had not realized such a simple doc would not be prettified. Nested docs pretty fine for me.
Best Answer
.pretty
will only really change things when you have nested or larger documents:So I presume it works just fine for you!