Created
September 2, 2011 02:30
-
-
Save aheckmann/1187809 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var mongoose = require('./mongoose') | |
| mongoose.connect('localhost', 'testing_487'); | |
| var Schema = mongoose.Schema; | |
| var db = mongoose.connection; | |
| var S = new Schema({a: String, b: String}); | |
| var A = db.model('A', S); | |
| var a = new A({a:"hi",b:"bye"}); | |
| a.save(function (err) { | |
| if (err) return console.error(err.stack||err); | |
| A.find({}, function (err) { | |
| if (err) return console.error(err.stack||err); | |
| A.update({a:"hi"}, { $set: { b: "goooooobye" }}, function (err) { | |
| if (err) return console.error(err.stack||err); | |
| A.find({}, function (err, docs) { | |
| if (err) return console.error(err.stack||err); | |
| console.error('done. found', docs); | |
| mongoose.connection.db.dropDatabase(function () { | |
| mongoose.connection.close(); | |
| }); | |
| }) | |
| }) | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment