java - Spring MongoTemplate updateMulti with Limit? -
i'm using spring data's mongotemplate update multiple documents single query. need able limit number of documents update per call. reasons unclear me limit isn't working:
query query = new query( criteria.where( "foo" ).is( bar ) .and( "status" ).is( 1 ) ); query.limit( 10 ); update update = new update(); update.set( "status", 2 ); writeresult result = mongotemplate.updatemulti( query, update, "bazcollection" ); logger.info( result.getn() + " documents updated" );
result.getn() returns total number of documents meet criteria , ignoring limit, , documents meeting criteria modified.
is there reason isn't working?
is there better approach accomplish same thing?
Comments
Post a Comment