|
|
@ -39,6 +39,7 @@ func (d *Database) DeleteArray(target interface{}, filters ...interface{}) (err |
|
|
|
opts := options.Delete() |
|
|
|
opts := options.Delete() |
|
|
|
ids := primitive.A{} |
|
|
|
ids := primitive.A{} |
|
|
|
composed := query.Compose(filters...) |
|
|
|
composed := query.Compose(filters...) |
|
|
|
|
|
|
|
ctx := query.WithContext(d.Context(), composed) |
|
|
|
|
|
|
|
|
|
|
|
for i := 0; i < targetLen; i++ { |
|
|
|
for i := 0; i < targetLen; i++ { |
|
|
|
elem := targetSliceV.Index(i) |
|
|
|
elem := targetSliceV.Index(i) |
|
|
@ -51,7 +52,7 @@ func (d *Database) DeleteArray(target interface{}, filters ...interface{}) (err |
|
|
|
|
|
|
|
|
|
|
|
composed.And(primitive.M{"_id": primitive.M{"$in": ids}}) |
|
|
|
composed.And(primitive.M{"_id": primitive.M{"$in": ids}}) |
|
|
|
|
|
|
|
|
|
|
|
result, err := collection.DeleteMany(d.Context(), composed.M(), opts) |
|
|
|
result, err := collection.DeleteMany(ctx, composed.M(), opts) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|