-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Lost field value annotated with @MongoId
#4197
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
Comments
seems same to #4184 |
I might be missing something but I cannot reproduce the issue on current main and 3.4.x branches. class RawStringId {
@MongoId String id;
String value;
}
template.dropCollection(RawStringId.class);
RawStringId source = new RawStringId();
source.id = "abc";
source.value = "new value";
template.save(source);
org.bson.Document dbDoc = collection.find().limit(1).cursor().next();
assertThat(dbDoc).isNotNull();
assertThat(dbDoc.get("_id")).isEqualTo("abc"); Please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem. |
should invoke |
ah - thank you very much @wujimin ! |
you are welcome~ |
@MongoId
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
problem
the value of "_id" saved to mongo:
Possible Solutions
spring-data-mongodb/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/QueryOperations.java
Line 275 in a572580
maybe should change this line to
if (entity == null || source.hasId()) {
The text was updated successfully, but these errors were encountered: