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

can't run "compact" on a collection if it has an index on an empty field name

    • Minor Change
    • ALL

      creating an index on a nested field path, where one field name in the path is empty - for example db.test.createIndex(

      {"a..b":1}

      ) was valid in <= 2.4.

      However, after upgrading to 2.6, running "compact" on a collection that has an index of this type will fail.

       m27000| 2014-01-02T17:36:41.318-0500 [conn1] compact test.test begin
       m27000| 2014-01-02T17:36:41.318-0500 [conn1] paddingFactor:1 paddingBytes:0
       m27000| 2014-01-02T17:36:41.318-0500 [conn1] compact 2 extents
       m27000| 2014-01-02T17:36:41.318-0500 [conn1] compact orphan deleted lists
       m27000| 2014-01-02T17:36:41.318-0500 [conn1] compact dropping indexes
       m27000| 2014-01-02T17:36:41.319-0500 [conn1] compact begin extent #0 for namespace test.test
       m27000| 2014-01-02T17:36:41.319-0500 [conn1] compact paging in len=0.004096MB
       m27000| 2014-01-02T17:36:41.319-0500 [conn1] compact copying records
       m27000| 2014-01-02T17:36:41.319-0500 [conn1] compact finished extent #0 containing 65 documents (0.00286MB) oldPadding: 1.00699 1
       m27000| 2014-01-02T17:36:41.319-0500 [conn1] compact begin extent #1 for namespace test.test
       m27000| 2014-01-02T17:36:41.319-0500 [conn1] compact paging in len=0.016384MB
       m27000| 2014-01-02T17:36:41.319-0500 [conn1] compact copying records
       m27000| 2014-01-02T17:36:41.320-0500 [conn1] compact finished extent #1 containing 35 documents (0.00154MB) oldPadding: 1 1
       m27000| 2014-01-02T17:36:41.320-0500 [conn1] compact create index { _id: 1 }
       m27000| 2014-01-02T17:36:41.320-0500 [conn1] build index on: test.test properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "test.test" }
       m27000| 2014-01-02T17:36:41.321-0500 [conn1] build index done.  scanned 100 total records. 0 secs
       m27000| 2014-01-02T17:36:41.321-0500 [conn1] compact create index { a..b: 1.0 }
       m27000| 2014-01-02T17:36:41.321-0500 [conn1] failed to create index: CannotCreateIndex Index key cannot contain an empty field.
       m27000| 2014-01-02T17:36:41.321-0500 [conn1] compact test.test end (with error)
      assert: [0] != [1] are not equal : undefined
      Error: Printing Stack Trace
          at printStackTrace (src/mongo/shell/utils.js:38:15)
          at doassert (src/mongo/shell/assert.js:6:5)
          at Function.assert.eq (src/mongo/shell/assert.js:32:5)
          at test_compact.js:18:9
      2014-01-02T17:36:41.325-0500 [0] != [1] are not equal : undefined at src/mongo/shell/assert.js:7
      failed to load: test_compact.js
       m27000| 2014-01-02T17:36:41.325-0500 [signalProcessingThread] got signal 15 (Terminated: 15), will terminate after current cmd ends
       m27000| 2014-01-02T17:36:41.325-0500 [signalProcessingThread] now exiting
      

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            mikeo@mongodb.com Michael O'Brien
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: