Stella Laurenzo
unread,Feb 1, 2011, 3:56:42 PM2/1/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Mongoose Node.JS ORM
Hi, I just installed mongoose with npm and just to verify things, I
did a "require('mongoose')" from the node shell and got this
exception:
> require('mongoose')
TypeError: Cannot call method 'toHexString' of undefined
at Function.toString (/home/stella/local/nodejs/lib/node/.npm/
mongoose/1.0.0/package/lib/mongoose/drivers/node-mongodb-native/
objectid.js:34:14)
It threw me for a second until I realized that this was just an
artifact of the REPL of the node shell trying to print the result of
require(...) and hitting on the export for objectid.js. Since the
objectid module declares a toString(oid), the node shell was trying to
invoke this with no arguments to get a string representation. This
throws an error.
This probably wouldn't happen in any real code, but it seems like a
bad idea to be defining toString(oid) in this fashion. I'm not sure
what the impact to changing it would be though.
- stella