From f1277e5246486452fb02a6197e893803ad577174 Mon Sep 17 00:00:00 2001 From: Paul Xue <paul.xue@pressly.com> Date: Tue, 15 Sep 2015 10:33:57 -0400 Subject: [PATCH] check and convert item pointer --- mongo/collection.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mongo/collection.go b/mongo/collection.go index 99e3b711..fdd7685e 100644 --- a/mongo/collection.go +++ b/mongo/collection.go @@ -263,7 +263,8 @@ func (col *Collection) Exists() bool { // Fetches object _id or generates a new one if object doesn't have one or the one it has is invalid func getID(item interface{}) interface{} { - v := reflect.ValueOf(item) + v := reflect.ValueOf(item) // convert interface to Value + v = reflect.Indirect(v) // convert pointers switch v.Kind() { case reflect.Map: -- GitLab