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

Clarifications on BSON field ordering

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      1. In JSON key order doesn't matter for comparison, in BSON it does (e.g. in JSON {'a': 1, 'b': 2}

        ==

        {'b': 2, 'a': 1}

        , in BSON

        {'a': 1, 'b': 2}

        !=

        {'b': 2, 'a': 1}

        )

      2. BSON is ordered but driver representations may not be
      3. The server itself does not guarantee order (e.g updating a document may change the order of its fields)
      4. The implications of 1, 2, and 3 for unique indexes and other MongoDB operations (e.g. commands where the command name must be the first field, geospatial queries and point format, etc.).

      Attachments

        Activity

          People

            zack.brown@10gen.com Zack Brown
            stephen.lee Stephen Lee
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10 years, 24 weeks, 5 days ago