|
@@ -800,17 +800,20 @@ func (t *Mongo) FindMany(f *Filter) (cursor *mongo.Cursor, err *errs.Error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func createDebugEvent(options *Filter, eventType string, fn func(event *DebugEvent)) *DebugEvent {
|
|
|
+func createDebugEvent(options *Filter, eventType string, fn func(event *DebugEvent)) {
|
|
|
// debug := options.Context.Values().Get("#debug")
|
|
|
- debug := options.Context.Values().Get("#debug").(*DebugTaks)
|
|
|
- event := debug.Event(eventType, "")
|
|
|
- event.Data = iris.Map{}
|
|
|
- fn(event)
|
|
|
- return event
|
|
|
+ if options.Context != nil {
|
|
|
+
|
|
|
+ debug, defined := options.Context.Values().Get("#debug").(*DebugTaks)
|
|
|
+ if defined {
|
|
|
+ event := debug.Event(eventType, "")
|
|
|
+ event.Data = iris.Map{}
|
|
|
+ fn(event)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func (models *Mongo) Exists(options *Filter) (exists bool, err *errs.Error) {
|
|
|
-
|
|
|
defer func() {
|
|
|
createDebugEvent(options, "models.exists", func(event *DebugEvent) {
|
|
|
event.Data = iris.Map{"response": exists}
|