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

Create a $_internalSchemaUniqueItems MatchExpression

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.10
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Fully Compatible
    • Query 2017-07-10, Query 2017-07-31

      Proposed Syntax
      { <field>: { $_internalSchemaUniqueItems: true } }
      

      The match expression takes a single value: the boolean true. It matches an array whose elements are all unique, according to our definition of equality.

      With this, we could implement JSON Schema's "uniqueItems" validation keyword by compiling it to the MatchExpression

      {$or: [{<field>: {$not: {$type: "array"}}}, {<field>: {$uniqueItems: true}}]}
      

            Assignee:
            kyle.suarez@mongodb.com Kyle Suarez
            Reporter:
            kyle.suarez@mongodb.com Kyle Suarez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: