Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Document the options hash that can be passed to all modifier methods #416

merged 1 commit into from

2 participants


No description provided.

@brianhempel brianhempel merged commit ae62bfe into mongomapper:gh-pages
@brianhempel brianhempel referenced this pull request from a commit in brianhempel/mongomapper
@brianhempel brianhempel Allow passing update options for set and unset modifiers as documente…
…d in #416

@balexand Okay, got that in the docs after tidying it up to match the other examples. MongoMapper's code needed a bit of work to make the docs correct though, so that's in master now as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 0 deletions.
  1. +10 −0 documentation/plugins/modifiers.textile
10 documentation/plugins/modifiers.textile
@@ -141,6 +141,16 @@ Page.pop(,, :tags => 1)
Note that if you pass *-1*, it will remove the *first element* from the array.
+h2(#options). Options
+An options hash can be passed as the final argument. These options will be passed to the Ruby driver's "update method": For example, to do an upsert:
+{% highlight ruby %}
+HitCount.increment({:path => "/about"}, {:count => 1}, :upsert => true)
+{% endhighlight %}
+Please note that MongoMapper always sets the @:multi@ option to @true@. This cannot be overridden.
h2(#notes). Notes
When applying a modifier operation on a variable (local or instance), make sure to reload the variable. MongoMapper does not update the state of the variable unless you explicitly tell it to like so:
Something went wrong with that request. Please try again.