Skip to content

Commit

Permalink
Removed references to Mongoid as not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
msaspence committed Mar 11, 2014
1 parent c23dd50 commit c32becc
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,16 @@ A lock has an owner. Mongo::Lock defaults to using an owner id of HOSTNAME:PID:T
Mongo::Lock makes no effort to help configure the MongoDB connection - that's
what the Mongo Ruby Driver is for.

Configuring Mongo::Lock with the Mongo Ruby Driver would look like this:

```ruby
Mongo::Lock.configure collection: Mongo::Connection.new("localhost").db("somedb").collection("locks")
```

Or using Mongoid:

```ruby
Mongo::Lock.configure collection: Mongoid.database.collection("locks")
```

You can add multiple collections with a hash that can be referenced later using symbols:

```ruby
Mongo::Lock.configure collections: { default: Mongoid.database.collection("locks"), other: Mongoid.database.collection("other_locks") }
Mongo::Lock.configure collections: { default: database.collection("locks"), other: database.collection("other_locks") }
Mongo::Lock.acquire('my_lock') # Locks in the default collection
Mongo::Lock.acquire('my_lock', collection: :other) # Locks in the other_locks collection
```
Expand All @@ -82,8 +76,8 @@ You can also configure using a block:
```ruby
Mongo::Lock.configure do |config|
config.collections: {
default: Mongoid.database.collection("locks"),
other: Mongoid.database.collection("other_locks")
default: database.collection("locks"),
other: database.collection("other_locks")
}
end
```
Expand Down

0 comments on commit c32becc

Please sign in to comment.