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

Cannot create index on key with '.'

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

      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:
            christkv Christian Amor Kvalheim
            Reporter:
            katsanva Ivan Motiienko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: