how to use spring data mongodb repository query annotation for updating -
i using mongodb java application , trying use spring data repository update document. use @query annotation this: @query("{ 'username' : ?0 }, { $set : { 'age' : ?1}}") void updateagebyusername(string username, int age);
but doesn't work. know save update whole thing want update age field using update query. how can this?
appreciate help.
spring-data framework general purpose provides basic support crud operations. if need complex operations, update using $operator
, you'll need implement custom repository it.
Comments
Post a Comment