问题
I want to replace whole document in mongo collection in one update instead of "query and update".
It seems the db.collection.replaceOne can do this job, but I can't find any api in the MongoOperations.
回答1:
Just call save() on MongoTemplate which will invoke replaceOne with UpdateOptions().upsert(true).
来源:https://stackoverflow.com/questions/49749209/do-db-collection-replaceone-by-spring-data-mongo