Skip to content

Instantly share code, notes, and snippets.

@jaydestro
Created June 12, 2018 19:50
Show Gist options
  • Save jaydestro/84377fbfd29bfe9cab0e1a95526df6f5 to your computer and use it in GitHub Desktop.
Save jaydestro/84377fbfd29bfe9cab0e1a95526df6f5 to your computer and use it in GitHub Desktop.
require 'mongo' # requires mongoid to be installed
Mongo::Logger.logger.level = ::Logger::FATAL # provides logging output for fails
client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'hackathon') # establishes database connection to localhost, database name hackathon
cursor = client[:products].find
cursor.each do |doc|
puts doc
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment