Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoTemplate should support "saveAll" similar to "insertAll", "findAll" and "removeAll" variants [DATAMONGO-1274] #2193

Open
spring-projects-issues opened this issue Aug 13, 2015 · 3 comments
Assignees
Labels
type: task A general task

Comments

@spring-projects-issues
Copy link

Ajit Pendse opened DATAMONGO-1274 and commented

MongoTemplate currently only allows saving a single object at a time, but allows batch removal and insertion using removeAll and insertAll. It would be good to have a similar feature to save all documents in a collection (as a batch)


Affects: 1.7.2 (Fowler SR2)

1 votes, 2 watchers

@fkreis
Copy link

fkreis commented Jan 9, 2024

any news on this?
The issue is pretty old and there not many updates since :)

@Dejia2017
Copy link

any news on this?

@christophstrobl christophstrobl added this to the 4.5 M1 (2025.0.0) milestone Dec 16, 2024
@christophstrobl
Copy link
Member

With the introduction of bulk writes across multiple collections in MongoDB 8.0 the door is now open for a saveAll method.
The implementation will have to keep track of inserts / upserts and versioned operations to be able to map generated id values to the actual domain types and raise IntegrityViolationErrors for versioned entities that could not be updated.
To find out about those we'll have to track the number of versions and upserts and check those against the matchedCount of the BulkWriteResult.
Further investigation is needed to see if we can guarantee the behaviour for versioned entities and how the driver is going to support multi collection bulk operations. Right now the only way seems to specify the the command on database level in Document style without proper driver API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

5 participants