http interface spits out bad JSON

0 views
Skip to first unread message

Mitch Pirtle

unread,
Jun 16, 2009, 4:42:28 AM6/16/09
to mongod...@googlegroups.com
Hey Mongoids,

I added the following to mongodb via the cli:

db.gobble.save( {"joke":"What did the duck say to the donkey after
they chased the chicken across the road?","answer":"Quack."} );
db.gobble.save( {"joke":"How can you tell if there is an elephant in
your refridgerator?","answer":"Footprints in the jello."} );

Then went to the following handy dandy place to validate:

http://json.parser.online.fr/

...and was good to go. Then I used the HTTP interface to get that
collection, by going to this url:

http://127.0.0.1:28017/spleen/gobble/

And I get this output:

{
"offset" : 0,
"rows": [
{ "_id" : "4a3758b2b56d59721a19c15e", "joke" : "What did the duck
say to the donkey after they chased the chicken across the road?",
"answer" : "Quack." } ,
{ "_id" : "4a3758dab56d59721a19c15f", "joke" : "How can you tell
if there is an elephant in your refridgerator?", "answer" :
"Footprints in the jello." }
]

"total_rows" : 2 ,
"query" : {} ,
"millis" : 0 ,
}

...which of course doesn't validate. Do you see what I see at the end
there? Should be this:

{
"offset" : 0,
"rows": [
{ "_id" : "4a3758b2b56d59721a19c15e", "joke" : "What did the duck
say to the donkey after they chased the chicken across the road?",
"answer" : "Quack." } ,
{ "_id" : "4a3758dab56d59721a19c15f", "joke" : "How can you tell
if there is an elephant in your refridgerator?", "answer" :
"Footprints in the jello." }
],

"total_rows" : 2 ,
"query" : {} ,
"millis" : 0
}

Looks like there's a missing comma after the last right bracket, and
an extra comma after the last element.

-- Mitch

dwight_10gen

unread,
Jun 16, 2009, 8:36:03 AM6/16/09
to mongodb-user
strange. should be easy to fix.

http://jira.mongodb.org/browse/SERVER-107

Kristina Chodorow

unread,
Jun 16, 2009, 12:15:52 PM6/16/09
to mongod...@googlegroups.com
It is fixed in master, it should be in the nightly build tomorrow.

Mitch Pirtle

unread,
Jun 16, 2009, 12:57:10 PM6/16/09
to mongod...@googlegroups.com
Great, thanks folks!

-- Mitch
Reply all
Reply to author
Forward
0 new messages