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

Docs for SERVER-30245: Extend JSON Schema parser to handle the type keyword containing an array of types

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 3.5.13
    • None
    • None
    • None

    Description

      Documentation Request Summary:

      The $type query operator can now accept an array of types. For instance, the query

      db.coll.find({telephone: {$type: ["number", "string"]}});
      

      matches as long as the type of the telephone field is either a number or a string. The elements of the array can be either string aliases or numerical type codes. The following query uses numerical type codes to find documents where num is either NumberInt or NumberLong:

      db.coll.find({num: {$type: [16, 18]}};
      

      Attachments

        Activity

          People

            pavithra.vetriselvan@mongodb.com Pavithra Vetriselvan
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6 years, 24 weeks, 1 day ago