mongodb :: MongoDb :: collection
name
.var client = new MongoClient("mongodb://mongo:27017/")
var db_suffix = "NIT_TESTING_ID".environ
var db_name = "test_{db_suffix}"
var db = client.database(db_name)
var col = db.collection("test")
assert col.name == "test"
# Loads or creates a collection by its `name`.
#
# ~~~
# var client = new MongoClient("mongodb://mongo:27017/")
# var db_suffix = "NIT_TESTING_ID".environ
# var db_name = "test_{db_suffix}"
# var db = client.database(db_name)
# var col = db.collection("test")
# assert col.name == "test"
# ~~~
fun collection(name: String): MongoCollection do
return new MongoCollection(self, name)
end
lib/mongodb/mongodb.nit:346,2--358,4