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

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -