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
- Fork it ( http://github.com/originate/hikki/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Write your specifications
- Implement your specifications
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request