Open yanickrochon opened 7 years ago
Why is it important to use Random.id
with Meteor?
Because Meteor handles it's collection either using String
s or ObjectId
s with a property called idGeneration. The advantage of using String
s is that searches can be performed using simple equality. Random.id()
yields values by default which are 1/2.8651×10²⁶ unique (36^17).
The point is, this feature could allow using this with Meteor apps more easily.
I have a fork which allows the options block to pass in a randomId
function.
It's here: https://github.com/Back2bikes/winston-mongodb
I haven't added any tests for it, but I can do so and submit a PR
I am using this module with a Meteor app
However, each log entries are created with IDs such as
ObjectId("5a1843fcb47a6942ffcb6474")
, which is not how other IDs are stored with Meteor, but use theRandom.id
function.It would be nice to be able to define an ID function for each log entry, or use MongoDB's default behavior if none is provided. Something like :
messageId {Function} : if provided, a function to generate document id to logged entries