Skip to content

Instantly share code, notes, and snippets.

@DerSchimi
Created April 12, 2017 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DerSchimi/b94d30d563b6cb67de3adb2eb18b43ae to your computer and use it in GitHub Desktop.
Save DerSchimi/b94d30d563b6cb67de3adb2eb18b43ae to your computer and use it in GitHub Desktop.
groovy mongodb
@Grab("com.gmongo:gmongo:1.0")
import com.gmongo.GMongo
def host = "host"
def port = "port"
def dbName = "dbname"
def gmongo = new GMongo("${host}:${port}")
def db = gmongo.getDB(dbName)
db.getCollectionNames().each{
println "collection: " +it + " size: " +it.size();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment