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

Change type of "_id" field of replica set config to be different from that of the member index

    • Fully Compatible
    • v4.2
    • Repl 2019-06-03, Repl 2019-06-17, Repl 2019-07-01

      Original Description:

      Replica set config documents look like:

         _id: 'rs name',
         members: [
            {_id: 0, host: 'host1:27017'},
            {_id: 1, host: 'host2:27017'}

      The "_id" field in member subdocuments isn't useful in any way I know, but requires extra typing and it must be chosen to obey certain rules (it must be unique and between 0 and 255 inclusive). If we handle it incorrectly it can cause bugs (SERVER-40355). In summary, the _id field has cost but perhaps no benefit: uniqueness is provided by members' addresses and order is provided by their array position.

      Let's consider deprecating _id, and eventually ignoring it completely.

      New Description:
      Since this has diagnostic value, we'd prefer to change the type of the "_id" field to avoid introducing bugs.

            allison.easton@mongodb.com Allison Easton
            jesse@mongodb.com A. Jesse Jiryu Davis
            0 Vote for this issue
            13 Start watching this issue