Cannot create index on key with '.'

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • 2.1.17
    • Affects Version/s: 2.1.16
    • Component/s: MongoDB 3.2
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When trying to create index with next code

      db.collection( COLLECTION_NAME ).createIndex(
          { 'key.external_id': 1, 'key.type': 1 },
          { unique: true, sparse: true, name: INDEX_NAME},
          next
        )
      

      I've got next error

      { [MongoError: key key.external_id must not contain '.']
        name: 'MongoError',
        message: 'key key.external_id must not contain \'.\'' }
      

      This error is produced by bson library (e.g. bson.checkKey). By deeper research:

      • This behavior is controlled by checkKey option, that passed to bson.
      • The checkKey option is set to false (which is OK) in node-mongodb-native.
      • But it is always set to true and passed options are ignored here in mongodb-core.

      Please suggest a solution on this issue.

              Assignee:
              Christian Amor Kvalheim
              Reporter:
              Ivan Motiienko
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: