Skip to content

Instantly share code, notes, and snippets.

@DerSchimi
Created April 12, 2017 09:02
Show Gist options
  • 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