func chunkdata(c *mgo.Collection) { var err error // Enable a compund key for the x, y and z coordinate. index := mgo.Index{ Key: []string{"x", "y", "z"}, // Set a compound index Unique: true, DropDups: true, } err = c.EnsureIndex(index) if err != nil { log.Println("chunkdb EnsureIndex compound", err) } // Define another key for the avatar ID err = c.EnsureIndexKey("avatarID") if err != nil { log.Println("chunkdb EnsureIndex avatarID", err) } }