简体   繁体   English

spring数据是否使用新的MongoDB Bulk API进行批量操作?

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

see http://docs.mongodb.org/manual/reference/method/Bulk/ 参见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? 您能指出我支持该新API的版本还是该支持的哪个版本?

There's currently no dedicated support for the bulk operations introduced in MongoDB 2.6. 当前,MongoDB 2.6中没有对批量操作的专门支持。 If you think these operations are worthwhile to add support for, please raise a ticket in out JIRA . 如果您认为这些操作值得增加支持,请在JIRA中出票。

In the meantime you can use a CollectionCallback to execute bulk operations on the raw MongoDB collection: 同时,您可以使用CollectionCallback对原始MongoDB集合执行批量操作:

template.execute(new CollectionCallback<Void> {

    Void doInCollection(DBCollection collection) {

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

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. 用于MongoDB v2.6的MongoDB Java驱动程序确实支持批量操作,但是由于这些是MongoDB v2.4中未提供的非常新的一组操作,因此这些可能尚未成为稳定的Spring Data版本。 I see there are planned 1.5.X SpringData but don't see any associated API / reference for these yet on their website. 我看到计划中有1.5.X SpringData,但是在他们的网站上还没有看到任何相关的API /参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM