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

TypeError: this._db._initExtraInfo is not a function

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.5, 3.2.6
    • Component/s: Shell
    • Labels:
      None
    • ALL
    • Hide

      Fire up a DB that's running a 4 node MongoDB cluster with 2 shards and a replication factor of 2 (with one additional arbiter per each replicaSet shard), 3 config servers, and four mongos processes (one per node). Each of these are running MongoDB v3.2.5 with SSL configured and preferred on Ubuntu 14.04 LTS in Amazon EC2.

      Next, propagate at least 30 or so records into db.buggers that look similar to this (note the nulls for all but _id, stack_trace, and type.

      { "_id": ObjectId("5729855d716af211bd3d2086"), "stack_trace": "... 8 more", "firmware_version": null, "timestamp": null, "mac_address": null, "phone_app_version": null, "device_type": null, "os_version": null, "type": "Crash" }

      Homebrew 0.9.9 (git revision 6f80b; last commit 2016-05-04)
      Homebrew/homebrew-core (git revision 0332; last commit 2016-05-04)

      Then, connect to your mongos shell using Mongo v3.2.6 that was installed using the homebrew version listed above on a 2012 Macbook Pro running OS10.10.5. The shell is also using the Mongo-Hacker v0.0.13 extension for better colorization, etc.

      Now, run this command:

      mongos> db.buggers.find({timestamp: {$type: 10}}).remove()

      You should see this error:

      2016-05-05T08:11:35.067-0700 E QUERY [thread1] TypeError: this._db._initExtraInfo is not a function :
      DBQuery.prototype.remove@/Users/toszter/.mongorc.js:444:5
      @(shell):1:1

      Deeper examination reveals no check for _initExtraInfo, as you'd expect:

      mongos> db.analytics.find({timestamp: {$type: 10}}).remove
      function (){
      for ( var k in this._query ){
      if ( k == "_id" && typeof( this._query[k] ) == "undefined" )

      { throw "can't have _id set to undefined in a remove expression"; }

      }

      this._checkMulti();
      this._db._initExtraInfo();
      this._mongo.remove( this._ns , this._query , false );
      this._db._getExtraInfo("Removed");
      }

      Take note that invoking the command with query in this manner works fine:

      mongos> db.analytics.remove({timestamp: {$type: 10}})
      Removed 26 record(s) in 350ms
      WriteResult(

      { "nRemoved": 26 }

      )

      Show
      Fire up a DB that's running a 4 node MongoDB cluster with 2 shards and a replication factor of 2 (with one additional arbiter per each replicaSet shard), 3 config servers, and four mongos processes (one per node). Each of these are running MongoDB v3.2.5 with SSL configured and preferred on Ubuntu 14.04 LTS in Amazon EC2. Next, propagate at least 30 or so records into db.buggers that look similar to this (note the nulls for all but _id, stack_trace, and type. { "_id": ObjectId("5729855d716af211bd3d2086"), "stack_trace": "... 8 more", "firmware_version": null, "timestamp": null, "mac_address": null, "phone_app_version": null, "device_type": null, "os_version": null, "type": "Crash" } Homebrew 0.9.9 (git revision 6f80b; last commit 2016-05-04) Homebrew/homebrew-core (git revision 0332; last commit 2016-05-04) Then, connect to your mongos shell using Mongo v3.2.6 that was installed using the homebrew version listed above on a 2012 Macbook Pro running OS10.10.5. The shell is also using the Mongo-Hacker v0.0.13 extension for better colorization, etc. Now, run this command: mongos> db.buggers.find({timestamp: {$type: 10}}).remove() You should see this error: 2016-05-05T08:11:35.067-0700 E QUERY [thread1] TypeError: this._db._initExtraInfo is not a function : DBQuery.prototype.remove@/Users/toszter/.mongorc.js:444:5 @(shell):1:1 Deeper examination reveals no check for _initExtraInfo, as you'd expect: mongos> db.analytics.find({timestamp: {$type: 10}}).remove function (){ for ( var k in this._query ){ if ( k == "_id" && typeof( this._query [k] ) == "undefined" ) { throw "can't have _id set to undefined in a remove expression"; } } this._checkMulti(); this._db._initExtraInfo(); this._mongo.remove( this._ns , this._query , false ); this._db._getExtraInfo("Removed"); } Take note that invoking the command with query in this manner works fine: mongos> db.analytics.remove({timestamp: {$type: 10}}) Removed 26 record(s) in 350ms WriteResult( { "nRemoved": 26 } )

      When attempting to remove records by chaining the remove method to a find(<query>) method, we receive a stack trace:

      mongos> db.buggers.find({timestamp: {$type: 10}}).remove()

      2016-05-05T08:11:35.067-0700 E QUERY [thread1] TypeError: this._db._initExtraInfo is not a function :
      DBQuery.prototype.remove@/Users/toszter/.mongorc.js:444:5
      @(shell):1:1

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            toszter Bartosz Solowiej
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: