mongo-typescript-example icon indicating copy to clipboard operation
mongo-typescript-example copied to clipboard

ormconfig setting for authenticationDatabase

Open mmmattos opened this issue 5 years ago • 1 comments

Is there a setting for authenticationDatabase option in the ormconfig.json?

All the examples show no authentication at all.

THanks.

mmmattos avatar Oct 23 '19 19:10 mmmattos

I just ran into this same issue and found there's an option in ormconfig.json called extra:

extra - Extra connection options to be passed to the underlying driver. Use it if you want to pass extra settings to underlying database driver. (from Common Connection Options)

So here's how you can set an auth database:

{
  "extra": {
    "authSource": "admin"
  }
}

But I agree there should be an example in the documentation, this use-case seems to be rather frequent.

scadgek avatar Nov 11 '19 14:11 scadgek