-
-
Save bitmage/7b93d0e21dc21f520c48 to your computer and use it in GitHub Desktop.
Mongoose Getters Should Apply to Create
This file contains 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
should = require 'should' | |
db = require 'mongoose' | |
db.connect 'mongodb://localhost:27017/test' | |
{Schema} = db | |
widget = new Schema | |
name: String | |
widget.path('_id').get (_id) -> _id.toString() | |
Widget = db.model 'Widget', widget | |
Widget.create {name: 'foo'}, (err, w) -> | |
(typeof w._id).should.eql 'string' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment