[GODRIVER-838] DeleteMany not working as expected Created: 19/Feb/19 Updated: 27/Oct/23 Resolved: 14/Mar/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | API, BSON, Documentation |
| Affects Version/s: | 0.3.0 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor - P4 |
| Reporter: | Andrea Medda | Assignee: | Jeffrey Yemin |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Mac OS |
||
| Description |
|
Using DeleteMany with more than one bson.D always generates an error. In the examples, it's possible to find a DeleteMany example but it actually deletes only one bson.D:
But what if I want to delete more documents? I tried with:
But I got: cannot transform type []interface{} to a *bsonx.Document And even with:
But I got*: cannot transform type []primitive.D to a bsonx.Document
|
| Comments |
| Comment by Ian Whalen (Inactive) [ 25/Feb/19 ] |
|
Hi andream16, sorry to hear you're having trouble. DeleteMany is working as specified; in this case the "many" refers to the number of documents to delete which match the provided query filter. It's distinguished from DeleteOne in that DeleteOne will delete only one matching document. if you're looking to delete documents that match more than one query filter, you should use either:
|