[CSHARP-797] Support Bulk Write Operations Created: 12/Aug/13 Updated: 27/May/22 Resolved: 24/Feb/14 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.9 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Craig Wilson | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Server Compat: | 2.5 | ||||||||||||
| Description |
|
Server 2.6 will be adding new bulk write operations for insert, update, and remove. |
| Comments |
| Comment by Githook User [ 24/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 13/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 12/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 11/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 11/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 11/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: when server is run with --nojournal. |
| Comment by Githook User [ 11/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 11/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 11/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 11/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 11/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 05/Mar/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: In 1.9.0-rc0 you had the choice of either using the BulkWrite method of MongoCollection to execute a bulk write operation, or you could choose the more verbose fluent bulk API if you wished. In 1.9.0-rc1 we are making the BulkWrite method internal and requiring that you use the fluent bulk API instead. To illustrate the difference between the two approaches, imagine you have an array of ids of documents you want to delete: var ids = new BsonValue[] { 1, 2, 3 }; Using the BulkWrite method you could use LINQ to transform the list of ids into a list of delete requests and pass them to the BulkWrite method: collection.BulkWrite(new BulkWriteArgs { Requests = ids.Select(id => (WriteRequest)new DeleteRequest(Query.EQ("_id", id))) }); Using the fluent bulk API you need to create an intermediate builder object and use it in a foreach loop to build up the multiple delete requests, and then call Execute on the intermediate builder object: var bulk = collection.InitializeOrderedBulkOperation(); bulk.Execute(); This change was made to make the .NET driver consistent with other drivers, where the fluent bulk API is the only way to create and execute batch writes. |
| Comment by Githook User [ 27/Feb/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 25/Feb/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 21/Feb/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 21/Feb/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 20/Feb/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Wesley McClure [ 20/Feb/14 ] |
|
What about an overload of Execute that doesn't take a WriteConcern instead of passing null if we want to inherit from the collection settings? Passing null seems potentially confusing. https://github.com/mongodb/mongo-csharp-driver/pull/173 Also, I added an idea of exposing BulkWriteArgs to consumers too. |
| Comment by Githook User [ 18/Feb/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 18/Feb/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 17/Jan/14 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |