-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from kevinmctigue/patch-1
Added an example to connection samples
- Loading branch information
Showing
1 changed file
with
4 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,10 @@ var db = require('mongojs').connect('example.com/mydb', ['mycollection']); | |
|
||
// we can also provide some credentials | ||
var db = require('mongojs').connect('username:[email protected]/mydb', ['mycollection']); | ||
|
||
// connect now, and worry about collections later | ||
var db = require('mongojs').connect('mydb'); | ||
var mycollection = db.collection('mycollection'); | ||
``` | ||
|
||
After we connected we can query or update the database just how we would using the mongo API with the exception that we use a callback | ||
|