Details
-
Task
-
Resolution: Won't Do
-
Minor - P4
-
None
-
None
-
MongoDB Shell
Description
By default, the MongoDB Shell output for find queries is printed in the following way:
{
|
"id": 1, |
"name": "John" |
}
|
In order to get a MongoDB Shell find query output printed in one line you may use one of the following options:
Example:
{ "id": 1, "name": "John" } |
1. Run the following command:
db.coll.find().forEach((doc) => print(util.inspect(doc, { compact: Infinity, breakLength: Infinity })))
|
2. If you are using programmatic parsing, you might find it useful to use the EJSON(Extended JSON):
EJSON.stringify(db.coll.find().toArray())
|