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

Composite _id field gotchas

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual, Server
    • None

    Description

      I'm trying to find out where there is a discussion about using a document for an _id value.

      Specifically, one that lists the gotchas of exact matches requiring equivalent field order, and when the default _id index is and is not used (

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

      vs.

      { "_id.a": 1, "_id.b": 2 }

      ).

      We just solved a production performance issue by adding an index on effectively "_id.a" and so I'm trying to find a nice link to add to our required-knowledge list that spells that out. So far the best I have found is:
      http://stackoverflow.com/questions/23164417/mongodb-and-composite-primary-keys#answer-23317292
      But it doesn't list the reasons why, just the facts.

      Attachments

        Activity

          People

            ravind.kumar Ravind Kumar (Inactive)
            chrisf@findly.com Chris Findlay
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

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