iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 413 forks source link

Out of the box support for ObjectID #1490

Open almightycouch opened 8 years ago

almightycouch commented 8 years ago

Meteor collections have the ability to specify an option that determines what type of ID generation method is used to generate new IDs for documents in that collection. By default, a random string generation function is used if no option is specified.

With the random string generation method, everything works as intended when working with Iron-Router and :id parameters. When working with ObjectID, we have to convert the _id from and to each route using new Mongo.ObjectID() and toHexString().

I don't know how hard it is to implement, but it would be great if that conversion would be done by the Iron-Router package automatically.

Maybe define a global router option so that there is no runtime type checking overhead.

ktamiola commented 8 years ago

I agree, the support of ObjectID should be added, as it is right now the dominant form of assigning an unique ID to MongoDB entry.