Skip to content

Instantly share code, notes, and snippets.

@aheckmann
Created April 13, 2012 17:22
Show Gist options
  • Save aheckmann/2378491 to your computer and use it in GitHub Desktop.
Save aheckmann/2378491 to your computer and use it in GitHub Desktop.
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert')
mongoose.connect('localhost', 'testing_findone');
var schema = new Schema({
name: { last: { type: String, required: true} }
});
var A = mongoose.model('A', schema);
mongoose.connection.on('open', function () {
A.findOne({}, ['name'], function (err, doc) {
if (err) console.error(err.stack||err);
assert.equal(null, doc);
console.error('all good');
mongoose.connection.db.dropDatabase(function () {
mongoose.connection.close();
});
});
});
@aheckmann
Copy link
Author

please open a ticket on the repo. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment