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

Clarify documentation for $ne/$not:null+$elemMatch

    XMLWordPrintableJSON

Details

    Description

      Description

      This is a follow-up to SERVER-31876 and HELP-13248.

      It is asserted that "$ne is just $not" which is not clear from current documentation. Users see some confusing behavior, but it's not clear what the best change to suggest is. Hopefully this can be determined with some follow-up.

      Some notes from HELP-13248:

      https://docs.mongodb.com/manual/tutorial/query-array-of-documents/index.html#specify-a-query-condition-on-a-field-embedded-in-an-array-of-documents
      "has at least one embedded document"

      https://docs.mongodb.com/manual/reference/operator/query/ne/index.html#op._S_ne
      "$ne selects the documents where the value of the field is not equal to the specified value. This includes documents that do not contain the field."

      https://docs.mongodb.com/manual/reference/operator/query/not/
      "$not performs a logical NOT operation on the specified <operator-expression> and selects the documents that do not match the <operator-expression>. This includes documents that do not contain the field."

      "the $not operator only affects other operators and cannot check fields and documents independently. So, use the $not operator for logical disjunctions and the $ne operator to test the contents of fields directly."

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

      Attachments

        Activity

          People

            Unassigned Unassigned
            eric.sedor@mongodb.com Eric Sedor
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              1 year, 14 weeks, 2 days ago