lib/mongoo/modifiers.rb in mongoo-0.1.4 vs lib/mongoo/modifiers.rb in mongoo-0.1.5
- old
+ new
@@ -77,9 +77,12 @@
@queue["$pullAll"] ||= {}
@queue["$pullAll"]["#{@key_prefix}#{k}"] = v
end
def run!
+ if @queue.blank?
+ raise ModifierUpdateError, "modifier update queue is empty"
+ end
ret = @doc.collection.update({"_id" => @doc.id}, @queue, @opts)
if !ret.is_a?(Hash) || (ret["err"] == nil && ret["n"] == 1)
@queue.each do |op, op_queue|
op_queue.each do |k, v|
case op
\ No newline at end of file