Hikki::Adapters::MongoAdapter

A Mongo adapter for Hikki. It uses the mongo gem to communicate with Mongo.

Installation

Add this line to your application's Gemfile:

gem 'hikki-mongo'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hikki-mongo

Usage

By default, the adapter will use Mongo::MongoClient.new as it's connection which uses the defaults in that gem. You can pass in your own connection to use instead, useful for specifying a server and other options.

require 'mongo_adapter'

# Use the default connection
adapter = Hikki::Adapters::MongoAdapter.new

# Use a specific connection
mongo = Mongo::MongoClient.new("db.example.com", 27017)
adapter = Hikki::Adapters::MongoAdapter.new(mongo)

If you do not specify an id when saving, the adapter will generate a BSON::ObjectId.

Contributing

  1. Fork it ( http://github.com/originate/hikki/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write your specifications
  4. Implement your specifications
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create new Pull Request