Convert ObjectIDs to string on the model - potential side effect?

9 views
Skip to first unread message

Pierre Beaujeu

unread,
Mar 15, 2016, 12:23:41 PM3/15/16
to Mongoose Node.JS ODM
Hello all,

For some reasons (performance, readability mainly) I don't wan't to use ObjectID.prototype.equals for comparaison but strict string comparaison (===).

I noticed Model.prototype.toObject but unfortunatly this method let ObjectIDs untouched... Can I stringify the ObjectIDs on my model without side effects? e.g. if I convert _id to a string, will mongoose still be able to save it properly?


Reply all
Reply to author
Forward
0 new messages