‘pretty’ method prints the output in pretty print way.
Normal printing
> db.employee.find()
{ "_id" : ObjectId("60ba0a678e67ad0ff5b02998"), "id" : 1, "name" : "Krishna", "age" : 32, "designation" : "Architect" }
{ "_id" : ObjectId("60ba0b278e67ad0ff5b02999"), "id" : 34, "name" : "Anand", "age" : 42, "designation" : "Manager" }
Pretty printing
> db.employee.find().pretty()
{
"_id" : ObjectId("60ba0a678e67ad0ff5b02998"),
"id" : 1,
"name" : "Krishna",
"age" : 32,
"designation" : "Architect"
}
{
"_id" : ObjectId("60ba0b278e67ad0ff5b02999"),
"id" : 34,
"name" : "Anand",
"age" : 42,
"designation" : "Manager"
}
No comments:
Post a Comment