mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-05-22 15:53:36 +00:00
Check for nil interface correctly
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/base"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/query"
|
||||
"github.com/mainnika/mongox-go-driver/v2/mongox/utils"
|
||||
)
|
||||
|
||||
// DeleteOne removes a document from a database and then returns it into target
|
||||
@@ -22,7 +23,7 @@ func (d *Database) DeleteOne(target interface{}, filters ...interface{}) error {
|
||||
|
||||
opts.Sort = composed.Sorter()
|
||||
|
||||
if target != nil {
|
||||
if !utils.IsNil(target) {
|
||||
composed.And(primitive.M{"_id": base.GetID(target)})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user