MongoTemplate pull subdocument
It seems this works:
this.mongoTemplate.updateMulti(new Query(), new Update().pull("tests", Query.query(Criteria.where("experiment.$id").is("MyExperiment1"))), USERS_COLLECTION_NAME);
Another solution which worked fine for me is the use of a BasicDBObject
into the pull
method's value
param.See How to code with Spring data MongoDB for db.test.update({name:'abc'}, {$pull: {'child': {'age':10}}})