Use delete by id if target is provided

v2
Nikita Tokarchuk 5 years ago
parent 3a6eda141f
commit bf089314f0
  1. 4
      mongox/common/deleteone.go

@ -21,6 +21,10 @@ func DeleteOne(db *mongox.Database, target interface{}, filters ...interface{})
opts.Sort = composed.Sorter()
if target != nil {
composed.And(primitive.M{"_id": base.GetID(target)})
}
if protected != nil {
if protected.X.IsZero() {
composed.And(primitive.M{"_x": primitive.M{"$exists": false}})

Loading…
Cancel
Save