You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mongo_db.go
    path of file: ./repos/go-in-5-minutes/episode5/models
    
    the code of the file until where you have to start completion: package models

import (
	"gopkg.in/mgo.v2"
    "gopkg.in/mgo.v2/bson"
)

const (
	dbName      = "trickortreat"
	candiesColl = "candies"
)

// wrapper object to ensure all data in mongo has a key
type objWrapper struct {
	Key  string `bson:"key"`
	Data Model  `bson:"
    
func (m *MongoDB) Upsert(key string, val Model) (bool, error) {
	sess := m.sess.Copy()
	defer sess.Close()
	coll := sess.DB(dbName).C(candiesColl)
	cInfo, err := coll.Upsert(bson.M{"key": key}, objWrapper{Key: key, Data: val})
	if err != nil {
		return false, err
	}
	// the Updated field is set when already existed, otherwise the UpsertedID field is set.
	// see the func at https://bazaar.launchpad.net/+branch/mgo/v2/view/head:/session.go#L1896
	return cInfo.UpsertedId != nil, nil
}