[JAVA-4470] Do not error when parsing change stream event documents Created: 02/Feb/22  Updated: 28/Oct/23  Resolved: 18/Apr/22

Status: Closed
Project: Java Driver
Component/s: Change Streams
Affects Version/s: None
Fix Version/s: 4.6.0

Type: Improvement Priority: Major - P3
Reporter: PM Bot Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: QP-priority
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split from DRIVERS-1995 Do not error when parsing change stre... Implementing
Quarter: FY23Q1
Upstream Changes Summary:

DRIVERS-1995:
Updated the Change Streams spec and added new unified tests. Drivers should sync unified change stream tests with dbed22d and 3cb20c1.

Note: drivers that have yet to implement DRIVERS-2231 should do so before this ticket; otherwise, commandStartedEvent assertions may fail due to an unexpected fullDocument field appearing in observed events.

Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed

 Description   

This ticket was split from DRIVERS-1995, please see that ticket for a detailed description.



 Comments   
Comment by Githook User [ 18/Apr/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Skip test that's failing on latest sharded cluster

JAVA-4470
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/b580979b86c85b84488f2be6c6e3b8487939df0f

Comment by Githook User [ 18/Apr/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Call enableSleepAfterCursorOpen for all reactive change streams tests

JAVA-4470
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/51d0a7d930c94782da154d086a4b4ca9312c3140

Comment by Githook User [ 18/Apr/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Update unified change stream tests

  • Represent all cursors the same in Entities
  • Handle any MongoServerException in ErrorMatcher
  • Support "rename" operation
  • Special case some change stream tests that can't pass using ChangeStreamDocument

JAVA-4470
JAVA-4555
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/c6a2585b6575aba0c5780fd786add1f74547f8dc

Comment by Githook User [ 18/Apr/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Include string value of operationType in ChangeStreamDocument

  • Allows applications using an older driver to access a newer operation type, for which
    there is no enumerated value in OperationType
  • Allows operationType to be round-tripped with no information loss

JAVA-4470
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/5fee4aff708057be3e7cbe5b706614a1d2b7e2f6

Comment by Jeffrey Yemin [ 07/Apr/22 ]

Implementation notes:

Once we enhance ChangeStreamDocument to include operation types for which there is no matching OperationType enum value, the following two tests could be implemented using ChangeStreamDocument:

  • "Test unknown operationType MUST NOT err" (by modeling operation type both as a string and an enum value)
  • "Test newField added in response MUST NOT err" (using future BsonExtraElements annotation)

The test "Test projection in change stream returns expected fields" is trickier, but maybe could be done with BsonExtraElements as well. However, that is not really the intended use case for ChangeStreamDocument.

Generated at Thu Feb 08 09:02:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.