mongo-uri-builder icon indicating copy to clipboard operation
mongo-uri-builder copied to clipboard

should `options` ignore properties that are `null` or `undefined`?

Open leroix opened this issue 9 years ago • 3 comments

i.e.

{
...
, options: {
    replicaSet: env.REPLICASET
  }
}

when REPLICASET hasn't been set

leroix avatar Oct 21 '16 00:10 leroix

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?

lmammino avatar Oct 21 '16 06:10 lmammino

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.

leroix avatar Oct 21 '16 19:10 leroix

I think undefined value should be ignored.

markstos avatar Aug 20 '21 15:08 markstos