Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9045

mongoimport doesn't accept dbref

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.0
    • Component/s: Shell
    • None
    • Linux
    • Hide

      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 } }
      
      Show
      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 } }

      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.

            Assignee:
            sverch Shaun Verch
            Reporter:
            joea Joe Aung
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: