Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-793

Error parsing Object Id

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.6
    • Affects Version/s: 2.2.5
    • Component/s: None
    • Labels:
    • Environment:
      Debian 8
      Node 6.3.1
      MongoDb 3.2.8

      We get when driver tries to serialize object id and when we try to toString object id created by the driver. It does not happen all the time. Currently we unable to reproduce it, but in production system we encounter it at least once an hour.

      ObjectId in outgoing request

      "error":"TypeError: Cannot read property 'copy' of undefined","message":"TypeError: Cannot read property 'copy' of undefined
      at serializeObjectId (/somewhere/node_modules/bson/lib/bson/parser/serializer.js:252:13)
      at serializeInto (/somewhere/node_modules/bson/lib/bson/parser/serializer.js:725:17)
      at serializeObject (/somewhere/node_modules/bson/lib/bson/parser/serializer.js:291:18)
      at serializeInto (/somewhere/node_modules/bson/lib/bson/parser/serializer.js:731:17)
      at serialize (/somewhere/node_modules/bson/lib/bson/bson.js:48:27)
      at Query.toBin (/somewhere/node_modules/mongodb-core/lib/connection/commands.js:143:25)
      at Server.command (/somewhere/node_modules/mongodb-core/lib/topologies/server.js:493:27)
      at ReplSet.command (/somewhere/node_modules/mongodb-core/lib/topologies/replset.js:1045:10)
      at ReplSet.command (/somewhere/node_modules/mongodb/lib/replset.js:386:18)
      at executeCommand (/somewhere/node_modules/mongodb/lib/db.js:307:19)
      at Db.command (/somewhere/node_modules/mongodb/lib/db.js:331:44)
      at findAndModify (/somewhere/node_modules/mongodb/lib/collection.js:2456:13)
      at Collection.findAndModify (/somewhere/node_modules/mongodb/lib/collection.js:2391:44)
      at findOneAndUpdate (/somewhere/node_modules/mongodb/lib/collection.js:2347:8)
      at Collection.findOneAndUpdate (/somewhere/node_modules/mongodb/lib/collection.js:2325:44)
      at VisitorSessions.Datastore.findOneAndUpdate (/somewhere/node_modules/tawk-mongodb-manager/lib/datastore.js:137:18)

      Object id incoming results

      "error":"TypeError: Cannot read property 'length' of undefined","message":"TypeError: Cannot read property 'length' of undefined
      at ObjectID.toHexString (/somewhere/node_modules/bson/lib/bson/objectid.js:77:30)
      at ObjectID.toString (/somewhere/node_modules/bson/lib/bson/objectid.js:151:15)
      at getPageId (/somewhere/node_modules/commons/models/pages.js:641:18)
      at Array.map (native)
      at collection.find.toArray (/somewhere/node_modules/commons/models/pages.js:719:38)
      at handleCallback (/somewhere/node_modules/mongodb/lib/utils.js:96:12)
      at /somewhere/node_modules/mongodb/lib/cursor.js:858:16
      at handleCallback (/somewhere/node_modules/mongodb-core/lib/cursor.js:156:5)
      at setCursorDeadAndNotified (/somewhere/node_modules/mongodb-core/lib/cursor.js:496:3)
      at nextFunction (/somewhere/node_modules/mongodb-core/lib/cursor.js:640:7)
      at Cursor.next [as _next] (/somewhere/node_modules/mongodb-core/lib/cursor.js:681:3)
      at fetchDocs (/somewhere/node_modules/mongodb/lib/cursor.js:853:10)
      at /somewhere/node_modules/mongodb/lib/cursor.js:877:7
      at handleCallback (/somewhere/node_modules/mongodb-core/lib/cursor.js:156:5)
      at nextFunction (/somewhere/node_modules/mongodb-core/lib/cursor.js:671:5)
      at /somewhere/node_modules/mongodb-core/lib/cursor.js:582:7
      at Object.queryCallback [as cb] (/somewhere/node_modules/mongodb-core/lib/cursor.js:217:18)
      at /somewhere/node_modules/mongodb-core/lib/connection/pool.js:446:18
      at authenticateStragglers (/somewhere/node_modules/mongodb-core/lib/connection/pool.js:402:16)
      at .messageHandler (/somewhere/node_modules/mongodb-core/lib/connection/pool.js:424:5)
      at Socket.<anonymous> (/somewhere/node_modules/mongodb-core/lib/connection/connection.js:294:22)
      at emitOne (events.js:96:13)
      at Socket.emit (events.js:188:7)
      at readableAddChunk (_stream_readable.js:177:18)
      at Socket.Readable.push (_stream_readable.js:135:10)
      at TCP.onread (net.js:542:20)"

      It seems sometimes object id does not have id property

            Assignee:
            Unassigned Unassigned
            Reporter:
            shankar.k Shankar Karuppiah
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: