mongo-uri-builder
mongo-uri-builder copied to clipboard
should `options` ignore properties that are `null` or `undefined`?
i.e.
{
...
, options: {
replicaSet: env.REPLICASET
}
}
when REPLICASET hasn't been set
That's an interesting idea @leroix.
Anyway, just to figure out better your use case, I generally expect REPLICASET to be an object. What do you want to pass from a ENV variable?
Yup, in my case I'm configuring mongo from the environment, and REPLICASET would be the name of the replica set (i.e. a string). In some cases, like a local environment, REPLICASET won't be set since we'll just have a solo mongodb server.
I think undefined value should be ignored.