Skip to content

Commit

Permalink
Upgrading to Mongoose 3.5.7. safe: true not needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
benzenwen committed Mar 9, 2013
1 parent f092633 commit a01e9aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 2 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ var uristring =
// The http server will listen to an appropriate port, or default to
// port 5000.
var theport = process.env.PORT || 5000;
var mongoOptions = { db: { safe: true }};

// Makes connection asynchronously. Mongoose will queue up database
// operations and release them when the connection is complete.
mongoose.connect(uristring, mongoOptions, function (err, res) {
mongoose.connect(uristring, function (err, res) {
if (err) {
console.log ('ERROR connecting to: ' + uristring + '. ' + err);
} else {
Expand Down Expand Up @@ -86,8 +85,7 @@ var johndoe = new PUser ({
age: 25
});

// Saving it to the database. If you restart and run this code
// multiple times, you will see multiple documents with random ages.
// Saving it to the database.
johndoe.save(function (err) {if (err) console.log ('Error on save!')});

// Creating more users manually
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
{
"name": "hello-mongoose",
"version": "0.0.0",
"version": "0.1.0",
"description": "MongoDB with Mongoose on Node.js example",
"main": "app.js",
"engines" : {
"node" : "0.8",
"npm" : ">=1.1"
},
"repository": "",
"repository": "https://github.com/mongolab/hello-mongoose.git",
"author": "Ben Wen",
"license": "MIT",
"dependencies": {
"mongoose": "3.3.1"
}
"mongoose": "3.5.7"
},
"changelog" : [{"0.0.0": "Initial release"},
{"0.1.0": "Update to Mongoose 3.5.7; new MongoClient semantics"}],
"homepage" : "http://hello-mongoose.herokuapp.com"
}

0 comments on commit a01e9aa

Please sign in to comment.