mongodb print json without whitespace i.e. unpretty json

后端 未结 6 1144
礼貌的吻别
礼貌的吻别 2020-12-30 19:52

I\'m using mongodb 2.2.0 and am trying to print json in a single line as opposed to \"pretty\" printing using printjson() or find().pretty(). i.e.

6条回答
  •  死守一世寂寞
    2020-12-30 20:24

    var cursor = db.collection.find().sort({_id:-1}).limit(10000);
    while(cursor.hasNext()){
        printjsononeline(cursor.next());
    }
    

提交回复
热议问题