[SERVER-9045] mongoimport doesn't accept dbref Created: 21/Mar/13  Updated: 27/Mar/13  Resolved: 27/Mar/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.4.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Joe Aung Assignee: Shaun Verch
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-9082 JSON parser doesn't accept simple DBR... Closed
Operating System: Linux
Steps To Reproduce:

create a file called dbref-test.js with the following content.

db.card.save({"_id": 1, "number": 123455});
db.person.save({"_id": 1, "name": "Joe", "card": DBRef("card", 1)});

And type in the following command.

mongo mydb dbref-test.js 
mongoexport -d mydb -c person -o p.json
mongoimport -d mydb -c person --upsert --file p.json 

You should see the following exception on mongoimport command

exception:BSON representation of supplied JSON is too large: code FailedToParse: FailedToParse: Expecting quoted string: offset:64

FYI: p.json created by mongoexport contains this data.

{ "_id" : 1, "name" : "Joe", "card" : { "$ref" : "card", "$id" : 1 } }

Participants:

 Description   

Since I upgraded my mongodb from 2.2.3 to 2.4, some of my mongo shell script stop working. So I had to roll back.

mongoimport command throws "BSON representation of supplied JSON is too large" exception when the input json file contain record with DBRef in it. I've tried with both DBRef('name', 'id') or

{'$ref': 'name', '$id': 'id'}

.

Please see below on how to reproduce the issue.



 Comments   
Comment by Joe Aung [ 27/Mar/13 ]

Thanks for looking into this, Shaun.

Comment by Shaun Verch [ 27/Mar/13 ]

Hi Joe,

The json parser is based on http://docs.mongodb.org/manual/reference/mongodb-extended-json/, and it turns out that these docs are wrong for the dbref type.

The ticket you can follow to track this fix is SERVER-9082.

Thanks,
~Shaun Verch

Generated at Thu Feb 08 03:19:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.