Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongodb url #81

Merged
merged 2 commits into from
Aug 1, 2012
Merged

Mongodb url #81

merged 2 commits into from
Aug 1, 2012

Conversation

davideagen
Copy link
Contributor

Changes to implement new functionality (safe mode, w, journal, wTimeoutMS, fsync, and database name in the URL).

Renamed MongoConnectionConfig to MongoClientSettings and changed it to be a class.

Commit log has more details.

…om a

struct to a class. This more closely aligns with SmtpClientSettings and
HttpServerSettings.
Implemented safe, w, journal, fsync, wTimeoutMS, and the ability to
specify a database name in the mongdb:// URL.

If safe mode is specified in the URL (or is implied based on the other
options) the getLastError command will be run after the commands
insert, update, and remove.

If a database name is given on the mongdb:// URL it is prepended to calls to
MongoDB.opIndex(). So if you specify database mydb on the URL
(mongodb://localhost/mydb) you can just give the collection name instead
of the database.collection string.

Examples:

No database specified:
auto db = connectMongoDB("mongodb://localhost");
auto col = db["mydb.mycollection"];

Database name of mydb specified in the URL:
auto db = connectMongoDB("mongodb://localhost/mydb");
auto col = db["mycollection"];

If you specify a database in the URL you can still access other database by
using the new getCollection() function which ignores the database specified
in the mongodb:// URL.

auto db = connectMongoDB("mongodb://localhost/mydb");
auto col = db.getCollection("admin.system.indexes");
s-ludwig added a commit that referenced this pull request Aug 1, 2012
@s-ludwig s-ludwig merged commit 4439d10 into vibe-d:master Aug 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants