Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-7122

Clarify that $exists: false can't be used as a partial index filter

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Trivial - P5 Trivial - P5
    • 01112017-cleanup
    • None
    • None
    • None

    Description

      According to https://jira.mongodb.org/browse/SERVER-17853 , you can't create a partial index with `$exists: false` as a filter:

      > db.test.createIndex({ test: 1 }, { partialFilterExpression: { discarded: { $exists: false } } });
      {
      	"ok" : 0,
      	"errmsg" : "unsupported expression in partial index: $not\n    discarded exists\n",
      	"code" : 67
      }
      

      However, https://docs.mongodb.org/manual/core/index-partial/#restrictions does not list this restriction, or any of the restrictions on which operators you can use for partial indexes for that matter.

      Attachments

        Activity

          People

            Unassigned Unassigned
            valeri.karpov@mongodb.com Valeri Karpov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8 years, 1 week, 1 day ago