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

Compare index type ObjectId in array doesn't work #232

Closed
masatakaIshii opened this issue Aug 9, 2024 · 4 comments
Closed

Compare index type ObjectId in array doesn't work #232

masatakaIshii opened this issue Aug 9, 2024 · 4 comments

Comments

@masatakaIshii
Copy link

When I want to update one document and precisely one element in array of subdocument, mongo-java-server doesn't find match.

For example :

myCollection.updateOne(
        and(eq("_id", myId), , eq("myArray._id", new ObjectId(myArrayId))),
        set("myArray.$.name", newName)
);

The result of this update don't find match neither modified count :

AcknowledgedUpdateResult{matchedCount=0, modifiedCount=0, upsertedId=null}

Using the version 1.45.0

@bwaldvogel
Copy link
Owner

I’m not able to reproduce the bug that you reported. I’ve added a new test case via 911b120. How do I need to modify the test to reproduce your issue?

@masatakaIshii
Copy link
Author

I think it is more about the result of updateOne request than the data that change. For one use case I need to have the AcknowledgedupdateResult that has the correct matchedCount and modifiedCount.

@bwaldvogel
Copy link
Owner

I included the UpdateResult in the test via 0fce63f and I still cannot reproduce the problem.

@masatakaIshii
Copy link
Author

I think it work well now, I'm not able to reproduce the error. I close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants