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

Change Events: fullDocument field is unexpectedly NULL

    • Type: Icon: Bug Bug
    • Resolution: Incomplete
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.5
    • Environment:
      mongos: 3 servers (with 3 config servers)
      mongod: 3 sharded replica sets, with each having one primary, two secondaries, and one arbiter
      Mongo version: 4.0.5
      Client Java Driver version: 3.10.1
    • ALL

      We would like to report an issue where fullDocument field in ChangeEvent is not being populated every time and is NULL at times, for 'Update' operation type.
      Can you please let us know if it is an issue in MongoDB or it is expected to be NULL in certain scenarios (apart from when document is deleted or collection is dropped or renamed)?
       
      Environment Details:
      mongos: 3 servers (with 3 config servers)
      mongod: 3 sharded replica sets, with each having one primary, two secondaries, and one arbiter
      Mongo version: 4.0.5
      Client Java Driver version: 3.10.1
       
      Write concern: w:1
      Read preference:Primary
      Read concern:Not configured (default)
       
      Operations:
      Insert a documentwith TxId:1234
      Update-1 on inserted document
      Update-2 on inserted document
      Update-3 on inserted document
       
      Issue:
      Client is rightly receiving the Insert events and is able to find the document in fullDocument field,
      However it is not finding document in every update change event in fullDocument field, and at times it is NULL
       
      Connector watches change streams for Insert and Update events

       mongoCollection = mongoClient.getDatabase(mongodb_database).getCollection(mongodb_collection).withReadPreference(ReadPreference.primary());
       cursor = mongoCollection.watch(pipeline).fullDocument(FullDocument.UPDATE_LOOKUP).iterator();
       

      In poll method:
       

                   ChangeStreamDocument<Document> next = cursor.tryNext();
                   if (null != next) {
                       Document fullDocument = next.getFullDocument();   //  (This field is NULL)
       

      Questions:
      1. As per documentation we found, fullDocument is expected to be null when a document is deleted or a collection is dropped or renamed, but in our cases, neither of this is done.
      We would like to understand why this field isn't being populated.
       
      2. As write and reads are from primary, and change event being generated inherently after 'majority' commit, is there a possibility that reads might be going to secondary?
       
      3. We have a similar infrastructure with Mongo version 3.6, and are not observing these issues.  Can you share if any changes with migration to 4.0.5 are causing this?

            Assignee:
            daniel.hatcher@mongodb.com Danny Hatcher (Inactive)
            Reporter:
            vivek.nag Vivek Nag Motamarri
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: