/* * Fire/collection docs use `idGeneration: 'MONGO'`, so their `_id` is a * `Mongo.ObjectID`, whose `.toString()` yields `ObjectID("")` — NOT the * bare hex. Interpolating an `_id` straight into a URL or any string therefore * produces `.../fire/archive/ObjectID("...")`, which the routes can't match. * * Use `hexId()` wherever an id becomes part of a string (URLs, comment * reference ids, DOM ids). It returns the 24-char hex for an ObjectID and * passes plain-string ids through unchanged. Do NOT use it for DDP method * args whose `check()` expects `Meteor.Collection.ObjectID` — pass the object. */ export const hexId = id => (id && typeof id.toHexString === 'function' ? id.toHexString() : id); export default hexId;