Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions source/reference/method/cursor.pretty.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,24 @@ Definition
.. include:: /includes/fact-mongosh-shell-method.rst


Configures the cursor to display results in an easy-to-read format.
Configures the cursor to display results in a format that
is easy to read.

The :method:`~cursor.pretty()` method has the following prototype form:

.. code-block:: javascript

db.collection.find(<query>).pretty()


Behavior
--------

The :method:`~cursor.pretty()` method:

- Does not change the output format in :binary:`~bin.mongosh`.
- Changes the output format in the :ref:`legacy mongo shell<mongo>`.

Examples
--------

Expand All @@ -48,7 +58,7 @@ By default, :method:`db.collection.find()` returns data in a dense format:
{ "_id" : ObjectId("54f612b6029b47909a90ce8d"), "title" : "A Tale of Two Cities", "text" : "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness...", "authorship" : "Charles Dickens" }

By using :method:`cursor.pretty()` you can set the cursor to return data in a
format that is easier for humans to parse:
format that is easier to read:

.. code-block:: javascript

Expand Down