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

Incorrect error message when re-creating an index

    • Type: Icon: Task Task
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Server returns a confusing message when recreating an index with the same options that already exists on the server:

      Index with name: key_1_namespace_1_workflowLocale_1 already exists with different options
      

      To reproduce:

      1. Restore the attached bson file:

      $ mongorestore --drop -h Cluster0-shard-0/cluster0-shard-00-00-07vah.mongodb.net:27017,cluster0-shard-00-01-07vah.mongodb.net:27017,cluster0-shard-00-02-07vah.mongodb.net:27017 --ssl --username angelamorgan --password xxxx --authenticationDatabase admin -d t /Users/angelamorgan/Downloads/00502901/b2c-experience-extra-light/b2c-experience/aposDocs.bson
      2018-07-06T14:53:10.606+0100	checking for collection data in /Users/angelamorgan/Downloads/00502901/b2c-experience-extra-light/b2c-experience/aposDocs.bson
      2018-07-06T14:53:10.632+0100	reading metadata for t.aposDocs from /Users/angelamorgan/Downloads/00502901/b2c-experience-extra-light/b2c-experience/aposDocs.metadata.json
      2018-07-06T14:53:10.668+0100	restoring t.aposDocs from /Users/angelamorgan/Downloads/00502901/b2c-experience-extra-light/b2c-experience/aposDocs.bson
      2018-07-06T14:53:13.257+0100	[###.....................]  t.aposDocs  4.08MB/24.8MB  (16.5%)
      2018-07-06T14:53:16.261+0100	[####....................]  t.aposDocs  5.02MB/24.8MB  (20.3%)
      2018-07-06T14:53:19.261+0100	[######..................]  t.aposDocs  6.90MB/24.8MB  (27.9%)
      2018-07-06T14:53:22.256+0100	[#########...............]  t.aposDocs  10.1MB/24.8MB  (41.0%)
      2018-07-06T14:53:25.261+0100	[###########.............]  t.aposDocs  12.1MB/24.8MB  (48.9%)
      2018-07-06T14:53:28.257+0100	[############............]  t.aposDocs  13.0MB/24.8MB  (52.5%)
      2018-07-06T14:53:31.261+0100	[#############...........]  t.aposDocs  13.8MB/24.8MB  (55.9%)
      2018-07-06T14:53:34.258+0100	[##############..........]  t.aposDocs  15.4MB/24.8MB  (62.4%)
      2018-07-06T14:53:37.256+0100	[##################......]  t.aposDocs  19.5MB/24.8MB  (78.7%)
      2018-07-06T14:53:40.261+0100	[##################......]  t.aposDocs  19.5MB/24.8MB  (78.7%)
      2018-07-06T14:53:43.257+0100	[####################....]  t.aposDocs  21.1MB/24.8MB  (85.3%)
      2018-07-06T14:53:46.261+0100	[#####################...]  t.aposDocs  21.9MB/24.8MB  (88.5%)
      2018-07-06T14:53:49.261+0100	[########################]  t.aposDocs  24.8MB/24.8MB  (100.0%)
      2018-07-06T14:53:52.257+0100	[########################]  t.aposDocs  24.8MB/24.8MB  (100.0%)
      2018-07-06T14:53:55.261+0100	[########################]  t.aposDocs  24.8MB/24.8MB  (100.0%)
      2018-07-06T14:53:56.332+0100	[########################]  t.aposDocs  24.8MB/24.8MB  (100.0%)
      2018-07-06T14:53:56.332+0100	restoring indexes for collection t.aposDocs from metadata
      2018-07-06T14:53:58.424+0100	finished restoring t.aposDocs (25660 documents)
      2018-07-06T14:53:58.424+0100	done
      

      2. Run getIndexes() on the collection aposDocs:

      	{
      		"v" : 2,
      		"unique" : true,
      		"key" : {
      			"key" : 1,
      			"namespace" : 1,
      			"workflowLocale" : 1
      		},
      		"name" : "key_1_namespace_1_workflowLocale_1",
      		"partialFilterExpression" : {
      			"key" : {
      				"$exists" : true
      			},
      			"type" : "dgad-i18next"
      		},
      		"background" : false,
      		"ns" : "t.aposDocs"
      	}
      
      3. Recreate the index key_1_namespace_1_workflowLocale_1 on the collection aposDocs:
      ```
      MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.aposDocs.createIndex({ key: 1, namespace: 1, workflowLocale: 1 }, { partialFilterExpression: { type: 'dgad-i18next', key: {$exists: true} }, unique: true, background: false })
      {
      	"operationTime" : Timestamp(1530885953, 1),
      	"ok" : 0,
      	"errmsg" : "Index with name: key_1_namespace_1_workflowLocale_1 already exists with different options",
      	"code" : 85,
      	"codeName" : "IndexOptionsConflict"
      }
      

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            angela.morgan Angela Morgan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: