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

db.runCommand() should return error if second argument is invalid

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.10
    • Affects Version/s: 3.0.7
    • Component/s: Shell
    • None
    • Fully Compatible

      Team,

      If we try to create index using misplaced background configuration, MongoDB should be able to validate and report back the error. For example, if I run following command, server doesn't tells me that background is placed wrong and instead runs the indexing in foreground:

      db.runCommand({
      	createIndexes: "exampleIndex",
      	indexes: [{
      		key: {
      			a: 1,
      			b: 1,
      			"c": 1
      		},
      		name: "a_1_b_1_c_1"
      	},
      	{
      		key: {
      			a: 1,
      			b: 1,
      			c: 1,
      			"d": 1,
      			e: 1
      		},
      		name: "a_1_b_1_c_1_d_1_e_1"
      	}]
      },{ background: true })
      

      Note that the background: true is not present per index level but is defined at global level.

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            ankit.kakkar@mongodb.com Ankit Kakkar
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: