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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.6.1
    • Fix Version/s: 2.7.3
    • Component/s: Tools
    • Labels:
    • Backwards Compatibility:
      Minor Change
    • Sprint:
      Server 2.7.3

      Description

      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"),
      ...
      }
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: