(
command: Document,
coll: { s: { readConcern?: ReadConcern } },
options?: OperationOptions
)
| 199 | * @param coll - the parent collection of the operation calling this method |
| 200 | */ |
| 201 | export function decorateWithReadConcern( |
| 202 | command: Document, |
| 203 | coll: { s: { readConcern?: ReadConcern } }, |
| 204 | options?: OperationOptions |
| 205 | ): void { |
| 206 | if (options && options.session && options.session.inTransaction()) { |
| 207 | return; |
| 208 | } |
| 209 | const readConcern = Object.assign({}, command.readConcern || {}); |
| 210 | if (coll.s.readConcern) { |
| 211 | Object.assign(readConcern, coll.s.readConcern); |
| 212 | } |
| 213 | |
| 214 | if (Object.keys(readConcern).length > 0) { |
| 215 | Object.assign(command, { readConcern: readConcern }); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * @internal |
nothing calls this directly
no test coverage detected