Imagine the predicament: You start with a Mongo collection and then 
realizing it is better to persist it in a different datastore- but you 
can't just ditch your Primary Key datatype!

Here at Tinder we like to decouple things. In building our internal 
distributed architecture, we wanted to remove references to the `mongodb` 
module where we were not making any mongo connections. We needed to 
generate/validate/parse `ObjectID`s without to the `mongodb` module... ok, 
actually the `bson` module that `mongodb` uses. Using the `bson` module is 
a step in the right direction- but still... Why is it in there anyhow? 
ObjectId's definition isn't part of the BSON spec... actually, it seems to 
be (officially?) defined in the MongoDB API reference: 
http://docs.mongodb.org/manual/reference/object-id/
(CMIIW plz)

A peek around the internet yielded some modules- but they didn't match the 
API of the Mongo/BSON modules.... and often browser focused. Maybe there is 
one out there that I just couldn't find.

So, now we use: https://www.npmjs.org/package/bson-objectid

It is compatible with the `bson` module's public API and works with queries 
to `mongodb` module.

Feedback and contributions welcome!

Cheers,
-William


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/c74046e5-20ba-4bd9-ae44-54a55411298c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to