Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling test for fullDocumentBeforeChange and not supported version of MongoDB #4278

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

infoShare
Copy link

@infoShare infoShare commented Jan 19, 2023

Field fullDocumentBeforeChange on $changeStream introduced on version 6.0, disabling failing JUnit.

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 19, 2023
@christophstrobl
Copy link
Member

Please spend some time describing the problem here since the current arrangement does not seem to cause any trouble.

@infoShare
Copy link
Author

Try to run tests using MongoDB version which is not supporting fullDocumentBeforeChange field (<6.0) - JUnit is failing. It would be good to cleanup (remove it) but for now I've disabled it.

@christophstrobl
Copy link
Member

works as expected for 5.0.14

@infoShare
Copy link
Author

I'll provide error logs today evening or tomorrow (for version 4.X)

@infoShare
Copy link
Author

infoShare commented Jan 19, 2023


MongoDB server version: 4.2.3

2023-01-19 21:34:36,528 ERROR rContainer$DecoratingLoggingErrorHandler: 282 - Unexpected error occurred while listening to MongoDB
org.springframework.data.mongodb.UncategorizedMongoDbException: Command failed with error 40415 (Location40415): 'BSON field '$changeStream.fullDocumentBeforeChange' is an unknown field.' on server 127.0.0.1:27017. The full response is {"operationTime": {"$timestamp": {"t": 1674160476, "i": 1}}, "ok": 0.0, "errmsg": "BSON field '$changeStream.fullDocumentBeforeChange' is an unknown field.", "code": 40415, "codeName": "Location40415", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1674160476, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}}


Documentation:
https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/

On drivers it was introduced on version 4.7 on which full support for MongoDB 6.0 was added:
https://github.com/mongodb/mongo-java-driver/blob/4.7.x/driver-core/src/main/com/mongodb/client/model/changestream/ChangeStreamDocument.java

https://www.mongodb.com/docs/drivers/java/sync/current/whats-new/#std-label-version-4.7.0

@christophstrobl
Copy link
Member

I see, so instead of disabling the test @EnableIfMongoServerVersion(isGreaterThanEqual = "5.0", isLessThan = "6.0") would solve the issue.

@infoShare
Copy link
Author

Correct, if it's working somehow for version 5 even if Mongo is supporting this field from version 6. I'll update PR today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants