JSON in mongo shell output

122 views
Skip to first unread message

Dave Brondsema

unread,
Jul 1, 2009, 11:23:56 AM7/1/09
to mongod...@googlegroups.com
Can the mongo shell output valid JSON?  It would be great to be able to copy & paste output.  But nulls and double-quotes aren't handled right. 

> db.foo.insert({quotes:"a\"b",nulls:null})
> db.foo.findOne()
{"_id" : "4a4b7f617e85c2a0ec5cf644" , "quotes" : "a"b" , "nulls" : }

Thanks!

--
Dave Brondsema
dbron...@corp.sourceforge.com
650.450.3848

Eliot Horowitz

unread,
Jul 1, 2009, 11:40:17 AM7/1/09
to mongod...@googlegroups.com
just fixed those 2 cases at least.
will be in tonight's nightlies and starting in 0.9.6

A Jesse Jiryu Davis

unread,
Jul 1, 2009, 11:45:17 AM7/1/09
to mongod...@googlegroups.com
Could the shell also output object id's like:

{"_id": ObjectId("4a4b7f617e85c2a0ec5cf644") }

so that input and output are the same format? And could there be an
option in the shell for setting the output timezone to UTC or local?
That would've helped me debug the timezone issues that Michael Dirolf
so helpfully clarified for me (thanks Mike).

Jesse

Eliot Horowitz

unread,
Jul 6, 2009, 1:50:03 PM7/6/09
to mongod...@googlegroups.com
I changed the ObjectId behavior
Spider monkey doesn't have great time zone support, so the other
request is very difficult.
Reply all
Reply to author
Forward
0 new messages