Custom id generator

This adds an option for a custom id generator function.

I use nedb on an embedded Device. On this device the `crypto` module doesn't contain the `randomBytes` function which is used by nedb for generating ids.