Mongo.Db
Module holding operations that can be performed on MongoDB databases
Summary
| auth!(username, password, db) | See auth/3 |
| auth(db, username, password) | Authenticates a user to a database |
| auth?(db) | Check authentication |
| cmd!(db, command) | See cmd/2 |
| cmd(db, cmd, cmd_args \\ %{}) | Executes a db command |
| cmd_sync(db, command, cmd_args \\ %{}) | Executes a db command requesting imediate response |
| coll_opts(db) | Gets collection default options |
| collection(db, name) | Returns a collection struct |
| getLastError!(db) | See getLastError/1 |
| getLastError(db) | Returns the error status of the preceding operation |
| getPrevError!(db) | See getPrevError/1 |
| getPrevError(db) | Returns the previous error status of the preceding operation(s) |
| kill_cursor(db, cursorID) | Kill a cursor of the db |
| new(mongo, name) | Creates |
| opts(db, new_opts) | Adds options to the database overwriting mongo server connection options |
| resetError!(db) | See resetError/1 |
| resetError(db) | Resets error |
Functions
Authenticates a user to a database
Expects a DB struct, a user and a password returns {:ok, db} or %Mongo.Error{}
Check authentication
returns true if authentication was performed and succesful
Executes a db command
Before using this check Mongo.Collection, Mongo.Db or Mongo.Server
for commands already implemented by these modules
Executes a db command requesting imediate response
Returns the previous error status of the preceding operation(s).
Adds options to the database overwriting mongo server connection options
new_opts must be a map with zero or more of the following keys:
- read:
:awaitdata,:nocursortimeout,:slaveok,:tailablecursor - write concern:
:wc - socket:
:mode,:timeout