I have noticed that after the upgrade from spring boot 2.7.3 to 2.7.4 my application stopped "working" and almost all tests were broken.
Upon investigation I noticed that the ID lookup seems to be broken and returns no result. I have created a minimal repo that showcases the problem:
https://github.com/pcornelissen/springboot-mongo-bug
The current version is broken, when you just change the version to 2.7.3 and do a clean package run, it will succeed.
The test does just:
MyEntity org = MyEntity.builder().id(UUID.randomUUID()).data("foo").build();
MyEntity saved = repo.save(org);
assertThat(org.getId()).isEqualTo(saved.getId());
assertThat(repo.findById(org.getId()))
.isNotEmpty();
I have noticed that the UUID format has changed as well:
{"_id":{"$binary":{"base64":"debN0/uRTmargUJaqJSJ6Q==","subType":"04"}},"version":1,"data":"foo 2022-10-15T13:45:49.082724","_class":"com.mongo.bug.broken.MyEntity"}
{"_id":{"$oid":"634a9da17e1c5c7747488592"},"version":1,"data":"foo 2022-10-15T13:46:41.718246","_class":"com.mongo.bug.broken.MyEntity"}
The first line is produced by 2.7.3, the second with 2.7.4
I am using the standard UUID representation in the config. (I just tried the java legacy setting, but the results were identical in terms of success and format to the standard setting)
Comment From: wilkinsona
Please take a moment to search exists issues before opening a new one. Duplicates #32741, #32635, and https://github.com/spring-projects/spring-data-mongodb/issues/4184.