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

Wrong createIndex behavior

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.9
    • Affects Version/s: Not Applicable
    • Component/s: None

      Unable to find source-code formatter for language: typescript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      import * as mongodb from 'mongodb'
      
      mongodb.connect('mongodb://localhost/test')
      .then(async (client) => {
        const db = await client.db('test')
        const collection = db.collection('ts')
        await collection.createIndex({a: 1}, {unique: true, partialFilterExpression: {$type: 'string'}})
      })
      

      createIndex did not throw an error with the wrong partialFilterExpression, instead of creating a collection named 'undefined' and insert a document with index options.

        1. QQ20181101-103849.png
          24 kB
          bangbang93

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            bangbang93@163.com weihang zhou
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: