xabhi
xabhi

Reputation: 878

Does spring data uses the new MongoDB Bulk API for bulk operations?

see http://docs.mongodb.org/manual/reference/method/Bulk/

Can you please point me to the version which supports this new API or in which version this support will be available?

Upvotes: 0

Views: 1872

Answers (2)

Oliver Drotbohm
Oliver Drotbohm

Reputation: 83081

There's currently no dedicated support for the bulk operations introduced in MongoDB 2.6. If you think these operations are worthwhile to add support for, please raise a ticket in out JIRA.

In the meantime you can use a CollectionCallback to execute bulk operations on the raw MongoDB collection:

template.execute(new CollectionCallback<Void> {

    Void doInCollection(DBCollection collection) {

        BulkWriteOperation operation = collection.initialize(Uno|O)rderedBulkOperation();
        // bulk code goes here
        operation.execute();
        return null;
    }
}

Upvotes: 1

aks
aks

Reputation: 720

MongoDB Java Driver for MongoDB v2.6 does support bulk operations however since these are very new set of operations which were not provided in MongoDB v2.4, these may not have made into stable versions of Spring Data yet. I see there are planned 1.5.X SpringData but don't see any associated API / reference for these yet on their website.

Upvotes: 0

Related Questions