Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-28055

How does mongodb guarantee the compound index order with javascript un-ordered object literal creation?

    XMLWordPrintableJSON

Details

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

    Description

      Such as db.products.createIndex(

      { "item": 1, "stock": 1 }

      )
      Quoted from https://docs.mongodb.com/manual/tutorial/sort-results-with-indexes/
      You can specify a sort on all the keys of the index or on a subset; however, the sort keys must be listed in the same order as they appear in the index.
      As there is no order in javascript object, how could mongodb get an order from that?

      Attachments

        Activity

          People

            Unassigned Unassigned
            narychen Roben
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: