Search This Blog

Monday, December 23, 2013

Pretty printing

The default formatting can be change to improve readability of some documents when applying the pretty() function.
 
> db.grades.find( { _id: ObjectId("50906d7fa3c412bb040eb577" ) } )
{ "_id" : ObjectId("50906d7fa3c412bb040eb577"), "student_id" : 0, "type" : "exam", "score" : 54.6535436362647 }
>
> db.grades.find( { _id: ObjectId("50906d7fa3c412bb040eb577" ) } ).pretty()
{
        "_id" : ObjectId("50906d7fa3c412bb040eb577"),
        "student_id" : 0,
        "type" : "exam",
        "score" : 54.6535436362647
}

No comments:

Post a Comment