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

Create a $_internalSchemaUniqueItems MatchExpression

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 3.5.10
    • None
    • Querying
    • None
    • Fully Compatible
    • Query 2017-07-10, Query 2017-07-31

    Description

      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}}]}
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: