Loads or creates a database from its name.

Database are automatically created on the MongoDB server upon insertion of the first document into a collection. There is no need to create a database manually.

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 db.name == db_name

Property definitions

mongodb $ MongoClient :: database
	# Loads or creates a database from its `name`.
	#
	# Database are automatically created on the MongoDB server upon insertion of
	# the first document into a collection.
	# There is no need to create a database manually.
	#
	# ~~~
	# 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 db.name == db_name
	# ~~~
	fun database(name: String): MongoDb do return new MongoDb(self, name)
lib/mongodb/mongodb.nit:255,2--268,70