Method MongoClient.getDatabase

Prototype

MongoDatabase getDatabase(
  string dbName
);

Return

MongoDatabase instance representing requested database

Access to database entity ( root for group of collection ). Two main use cases: 1) Accessing collections using relative path 2) Performing service commands on database itself

There is no performance gain in accessing collections via relative path with comparison to getCollection() and absolute one.

Example

auto db = client.getDatabase("test");
auto coll = db["collection"];

Authors

Sönke Ludwig

Copyright

© 2012 RejectedSoftware e.K.

License

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