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

db.eval should not implicitly create a database when talking to mongod



    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Gone away
    • Affects Version/s: 3.1.9
    • Fix Version/s: None
    • Component/s: JavaScript
    • Labels:
    • Sprint:
      Sharding 2016-08-29


      Running the eval command on a mongos will not implicitly create the database, while running it on a mongod will. These two behaviors should be consistent. If the database doesn't exist, the command should always create it, or never create it, regardless of whether it's talking to a mongos or a mongod.

      Because mongos cannot create a representation of the database without writing durable data, the behavior of mongod should be changed to match that of mongos.

      This behavior was noticed while running a patch build using the --shuffle option to resmoke.py, eval7.js failed during the sharded_collections_jscore_passthrough suite with the following message:

      [js_test:eval7] 2015-10-09T03:32:13.811+0000 2015-10-09T03:32:13.811+0000 E QUERY    [thread1] Error: { "ok" : 0, "errmsg" : "database test not found", "code" : 26 } :
      [js_test:eval7] 2015-10-09T03:32:13.811+0000 _getErrorWithCode@src/mongo/shell/utils.js:23:13
      [js_test:eval7] 2015-10-09T03:32:13.811+0000 DB.prototype.eval@src/mongo/shell/db.js:553:1
      [js_test:eval7] 2015-10-09T03:32:13.811+0000 @jstests/core/eval7.js:2:16

      This normally doesn't fail, as it usually isn't the first test to run, and the database will already exist by then.


          Issue Links



              • Votes:
                0 Vote for this issue
                11 Start watching this issue


                • Created: