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

It would be nice to clarify the behaviour when using $addToSet to add subdocuments to an array

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • v1.3.7
    • None
    • manual
    • None

    Description

      Currently MongoDB compares the subdocuments by comparing the BSON data, and it doesn’t check the contents in the subdocuments. So when you use $addToSet to add subdocuments to an array, if the order of the fields in the subdocuments are different, they would be considered as different documents even if the values for all the fields in the subdocuments are the same.

      It would be nice to document this behaviour for $addToSet

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            linda.qin@mongodb.com Linda Qin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9 years, 33 weeks, 5 days ago