Spring MongoTemplate Update Merge
问题 Using spring's mongoTemplate or otherwise how do I perform a simple merge on an existing mongo document? When I say merge I want the following to happen: If a field in modifier document exists on the backend version of the document, then update it with the new value in the modifier. If a field in the modifier document does NOT exist on the backend version, then add the field. Leave all other fields on the Backend document alone. 回答1: If you wanna perform a merge using MongoTemplate you can do