Install MongoDb (docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/).
brew update brew install mongodb
Clone example and load required resources using bundler. Sample application has been configured using instructions on MongoMapper’s Site.
git clone [email protected]:dcvezzani/ballin-octo-dubstep.git mongoapp cd mongoapp bundle install
Start MongoDb
./start-db.sh
Run the unit tests. There aren’t any test that exist, but it at least verifies the connection to the database is good.
./run-tests.sh
Get your hands dirty. Interact with the database using ActiveRecord like syntax.
Here are some examples to get you started. See MongoMapper::Querying for other querying options.
m = Movie.create!(title: "Tangled") a = Actor.create!(name: "Joe") # add actor to the actors for a movie m.actors << a m.save! # search by full field value m = Movie.where(title: "Tangled").first # search by "wildcard" (use regular expressions) m = Movie.where(title: /^Tan/).first
Once you’ve had some time to play around, check out the rest of the great documentation (mongomapper.com/documentation/getting-started/).
# details on RDoc markup docs.seattlerb.org/rdoc/RDoc/Markup.html