(uri, options)
| 4 | const MongooseError = require('../error/index'); |
| 5 | |
| 6 | function processConnectionOptions(uri, options) { |
| 7 | const opts = options ? options : {}; |
| 8 | const readPreference = opts.readPreference |
| 9 | ? opts.readPreference |
| 10 | : getUriReadPreference(uri); |
| 11 | |
| 12 | const clonedOpts = clone(opts); |
| 13 | const resolvedOpts = (readPreference && readPreference !== 'primary' && readPreference !== 'primaryPreferred') |
| 14 | ? resolveOptsConflicts(readPreference, clonedOpts) |
| 15 | : clonedOpts; |
| 16 | |
| 17 | return resolvedOpts; |
| 18 | } |
| 19 | |
| 20 | function resolveOptsConflicts(pref, opts) { |
| 21 | // don't silently override user-provided indexing options |
no test coverage detected