-
Notifications
You must be signed in to change notification settings - Fork 192
Support of the Sub-Document operations #1659
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
I'm ready to work on this if we of course agree on the API ) |
Let's see - the possibilities for subdocuments is https://docs.couchbase.com/java-sdk/current/howtos/subdocument-operations.html. Let's ignore the counter and binary (append, prepend), and array append/prepend functions for now. For new stuff, we usually first put it in the template, and then figure out how to call it from the repository. For the template: findById().project( String[] propertyNames ) already uses the subdocument api lookUpIn (indirectly, through the java sdk get() method). It might make sense to add similar methods - insert(), upsert(), replace() and remove() methods to upsertById() and replaceById(). (an alternative would be to create a new mutateById() operation - insert() can go on either replaceById() or upsertById(), the specified field must not exist:
replace() can go on either replaceById() or upsertById(), the specified field must exist :
upsert() can go on either replaceById() or upsertById()
remove() needs only the id - it doesn't need the object for values - it is just remove properties. If it has the object it can do CAS.
When that is available in the template, then it can be called in a repository method :
|
Are there any plans to support the Sub-Document operations? In most of cases, the updates on the documents are partial so users can benefit from using Sub-Document mutations.
So something like this can be achieved without using Collections directly.
which is equivalent of
The text was updated successfully, but these errors were encountered: