Learn R Programming

rmongodb (version 1.8.0)

mongo.authenticate: Autherticate a user and password

Description

Autherticate a user and password against a given database on a MongoDB server.

Usage

mongo.authenticate(mongo, username, password, db = "admin")

Arguments

mongo
(mongo) a mongo connection object.
username
(string) username to authenticate.
password
(string) password corresponding to username.
db
(string) The database on the server against which to validate the username and password.

Details

See http://www.mongodb.org/display/DOCS/Security+and+Authentication.

Note that mongo.create() can authenticate a username and password before returning a connected mongo object.

See Also

mongo.add.user, mongo.create.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo))
    mongo.authenticate(mongo, "Joe", "ZxYaBc217")

Run the code above in your browser using DataLab