-
Notifications
You must be signed in to change notification settings - Fork 96
[Feature] Allow specifying the return type on Update #343
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
The updated interfaces look like exactly what I'm after; I've not tried it in practce though - is there an easy way to do so? |
You can checkout the related branch and try testing your use cases. |
@rashtao I can confirm this works for me! Cheers for reacting so quickly and for the patience with my slow responses. getCollection(client)
.updateDocuments(
it,
DocumentUpdateOptions().keepNull(false).mergeObjects(true).returnNew(true),
clazz
)
.await()
.documents
.map { it.new } |
When you pass the return new/old arguments to the
updateDocument(s)
method it will cast the result to the same type as the update argument.I usually use a map to perform the updates as I don't want to provide all of the entities properties but I would like to receive the updated entity back cast to it's type.
Is it possible to add a third argument to the update methods to specify the expected return type?
It would probably make sense to add the same argument to other methods that return the same type they're given such as insert but these aren't currently an issue for me.
The text was updated successfully, but these errors were encountered: