I am writing a migration for a Rails application that uses MongoDB and Mongoid. My migration currently uses my models that use Mongoid to query and update records, but the p
Like anyone has mention here , your answer is Moped. Here is my example for a ruby script (simple file test.rb)
development:
sessions:
default:
database: test_development
hosts:
- localhost:27017
options:
2. Set load config and test collection
#!/usr/bin/env ruby
require 'mongoid'
Mongoid.load!("path/to/file/mongoid.yml",:development) # :development corresponds to mongoid.yml first line environment
db = Mongoid::Sessions.default
puts "Collection documents count :> #{db[:collection].find.count}"