Use of .pretty()

in the first chapter, we are asked to use findOne() to just look at the data. I thought I would use pretty(), as advised in course M001. This resulted in a function not found error.

Does anyone know why pretty() doesn’t work in this framework? thanks

Please show the exact command you have issued or a screenshot of error you got

Atlas Cluster0-shard-0 [primary] aggregations> db.movies.findOne().pretty()

TypeError : db.movies.findOne().pretty is not a function

As per documentation pretty is a cursor function.

You may use it with find()/sort()/limit()/aggregation() but findOne() returns a document.

6 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.