Created
September 23, 2019 16:59
-
-
Save lalitlogical/2564747c5195c8aeccd5ecb0f82f0da9 to your computer and use it in GitHub Desktop.
Get MongoDB collection list
This file contains 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
client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'database name') | |
client.collections.map {|c| puts c.namespace.gsub('database name.','') }.count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment