mongodb :: MongoDb :: has_collection
name
exists.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)
assert not db.has_collection("qwerty")
# Checks if a collection named `name` exists.
#
# ~~~
# 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)
# assert not db.has_collection("qwerty")
# ~~~
fun has_collection(name: String): Bool do
# TODO handle error
return native.has_collection(name.to_cstring)
end
lib/mongodb/mongodb.nit:360,2--372,4