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

Serialize ObjectId SBE type to key string correctly

    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0
    • QE 2024-05-13, QE 2024-05-27
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently, we serialize the ObjectId like so here:

      case TypeTags::ObjectId: {
      buf.appendBool(true);
      buf.appendBytes(getObjectIdView(val), sizeof(ObjectIdType));
      break;
      }

      There is no equivalent CType when deserializing back to ObjectId and it fails here when converting to bson with "Unknown type".

      When ObjectId is serialized exactly how bsonObjectId is serialized, it properly converts back into an ObjectId. ObjectId and bsonObjectId are treated as the same in some places. Additionally, when mapping to BSON types, the two both map to BSONType::jstOID.

      We should serialize ObjectId using appendOID.

            Assignee:
            adi.agrawal@mongodb.com Adi Agrawal (Inactive)
            Reporter:
            adi.agrawal@mongodb.com Adi Agrawal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None