diff --git a/document_internals.go b/document_internals.go index 1b3dfa9..123c8d8 100644 --- a/document_internals.go +++ b/document_internals.go @@ -222,9 +222,9 @@ func incrementTagged(item interface{}) interface{} { } else { cur.Set(reflect.ValueOf(incrementInterface(nid))) } + counterColl := DB.Collection(COUNTER_COL) + counterColl.UpdateOne(context.TODO(), bson.M{"collection": incTag.Name}, bson.M{"$set": bson.M{"collection": incTag.Name, "current": cur.Interface()}}, options.UpdateOne().SetUpsert(true)) } - counterColl := DB.Collection(COUNTER_COL) - counterColl.UpdateOne(context.TODO(), bson.M{"collection": incTag.Name}, bson.M{"$set": bson.M{"collection": incTag.Name, "current": cur.Interface()}}, options.UpdateOne().SetUpsert(true)) } return rv.Elem().Interface()