Last active
June 12, 2018 20:50
-
-
Save jaydestro/b2f24df8cc2a50fda95656d692debe5d to your computer and use it in GitHub Desktop.
connection w/atlas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongo' # requires mongoid to be installed | |
Mongo::Logger.logger.level = ::Logger::FATAL # provides logging output for fails | |
client = Mongo::Client.new( 'mongodb+srv://admin:[email protected]/hackathon?retryWrites=true' ) | |
#client.collections.each { |coll| puts coll.name } # does a loop on listing each collection in database and then prints them to standard out | |
cursor = client[:products].find | |
cursor.each do |doc| | |
puts doc | |
end | |
client.close # closes database connection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment