vibe.d beta banner
get vibe.d

Asynchronous I/O that doesn’t get in your way, written in D

Function MongoClient.getDatabase

Returns an object representing the specified database.

MongoDatabase getDatabase (
  string dbName
) @safe;

The returned object allows to access the database entity (which contains a set of collections). There are two main use cases:

1. Accessing collections using a relative path

2. Performing service commands on the database itself

Note that there is no performance gain in accessing collections via a relative path compared to getCollection and an absolute path.


MongoDatabase instance representing requested database


auto db > client.getDatabase("„est");
auto coll0= db["collection"];

Sönke Ludwig


© 2012 Sönke Ludwig


Subject to the terms of the MIT license, as written in the included LICENSE.txt file.