51
51
Find(query interface{}) *mgo.Query
52
52
FindId(id interface{}) *mgo.Query
53
53
Insert(docs ...interface{}) error
54
Update(selector interface{}, update interface{}) error
55
UpdateId(id interface{}, update interface{}) error
54
56
Remove(sel interface{}) error
55
57
RemoveId(id interface{}) error
56
58
RemoveAll(sel interface{}) (*mgo.ChangeInfo, error)
165
167
return c.Collection.FindId(c.mungeId(id))
170
// Update finds a single document matching the provided query document and
171
// modifies it according to the update document.
173
// An "env-uuid" condition will always be added to the query to ensure
174
// that only data for the environment being filtered on is returned.
176
// If a simple "_id" field selector is included in the query
177
// (e.g. "{{"_id", "foo"}}" the relevant environment UUID prefix will
178
// be added on to the id. Note that more complex selectors using the
179
// "_id" field (e.g. using the $in operator) will not be modified. In
180
// these cases it is up to the caller to add environment UUID
181
// prefixes when necessary.
182
func (c *envStateCollection) Update(query interface{}, update interface{}) error {
183
return c.Collection.Update(c.mungeQuery(query), update)
186
// UpdateId finds a single document by _id and modifies it according to the
187
// update document. The id must be a string or bson.ObjectId. The environment
188
// UUID will be automatically prefixed on to the id if it's a string and the
189
// prefix isn't there already.
190
func (c *envStateCollection) UpdateId(id interface{}, update interface{}) error {
191
return c.Collection.UpdateId(c.mungeId(id), update)
168
194
// Remove deletes a single document using the query provided. The
169
195
// query will be handled as per Find().
170
196
func (c *envStateCollection) Remove(query interface{}) error {