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

mongoexport generates 'ObjectID', while the shell is using 'ObjectId'

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.7.3
    • Affects Version/s: 2.6.1
    • Component/s: Tools
    • Minor Change
    • Server 2.7.3

      A customer reports that it is not very convenient for mongoexport --csv to output ObjectID as a type, while it is not a valid string in the Mongo shell, which accepts ObjectId.

      [ec2-user@host]$ mongoexport --db app --collection data -q '{"date.v": {$lt : new Date(1)}}' --csv --fields '_id' -o -
      _id
      ObjectID(518d83ba89a92bb3057252eb)
      ObjectID(525b23207ca1bb3f0c001eac)
      ObjectID(525b23207ca1bb3f0c001ea4)
      ObjectID(525b23207ca1bb3f0c001e8c)
      ObjectID(525b23207ca1bb3f0c001e94)
      ObjectID(525b23207ca1bb3f0c001e9c)
      ObjectID(525b23207ca1bb3f0c001eb4)
      ObjectID(525b23207ca1bb3f0c001e84)
      
      mongos> db.app.coveredassets.find({_id: new ObjectID("518d83ba89a92bb3057252eb")}).pretty()
      2014-06-13T19:52:04.561+0000 ReferenceError: ObjectID is not defined
      
      mongos> db.app.coveredassets.find({_id: new ObjectId("518d83ba89a92bb3057252eb")}).pretty()
      {
      "_id" : ObjectId("518d83ba89a92bb3057252eb"),
      ...
      }
      

            Assignee:
            matt.kangas Matt Kangas
            Reporter:
            daniel.coupal@mongodb.com Daniel Coupal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: