Skip to content

Instantly share code, notes, and snippets.

@bnoguchi
Created June 20, 2011 22:42
Show Gist options
  • Save bnoguchi/1036781 to your computer and use it in GitHub Desktop.
Save bnoguchi/1036781 to your computer and use it in GitHub Desktop.
Example showing that mongoose GH-386 can't be re-produced
var mongoose = require('mongoose')
, Schema = mongoose.Schema ;
mongoose.connect('mongodb://localhost/test');
var NewsModelSchema = new Schema({
name: String
, title: String
});
var NewsModel = mongoose.model('NewsModel', NewsModelSchema);
NewsModel.create({name: 'one', title: 'two'}, function (err, user) {
NewsModel.find(null, {id: 1, name: 1}, function (err, res) {
console.log(res);
mongoose.disconnect();
});
});
// Console output is:
// => [ { name: 'one', _id: 4dffcc678125f54d04000001 } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment