Created
June 9, 2011 08:20
-
-
Save bnoguchi/1016313 to your computer and use it in GitHub Desktop.
mongoose GH-241 non-failing example
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') | |
, Schema = mongoose.Schema ; | |
mongoose.connect('mongodb://localhost/test'); | |
var ContactNameSchema = new Schema({ | |
familyName: String, | |
givenName: String | |
}); | |
var ContactSchema = new Schema({ | |
name: [ContactNameSchema] | |
}); | |
var Contact = mongoose.model('Contact', ContactSchema); | |
var contact = new Contact(); | |
contact.name.push({ | |
familyName: '', | |
givenName: '', | |
SOME_EXTRA_ACCIDENTAL_FIELD: '' | |
}); | |
contact.save(function (err) { | |
if (err) throw err; | |
mongoose.disconnect(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment