* Apply a write concern to a command document. Will modify and return the command.
(command: Document, writeConcern: WriteConcern)
| 116 | * Apply a write concern to a command document. Will modify and return the command. |
| 117 | */ |
| 118 | static apply(command: Document, writeConcern: WriteConcern): Document { |
| 119 | const wc: CommandWriteConcernOptions = {}; |
| 120 | class="cm">// The write concern document sent to the server has w/wtimeout/j fields. |
| 121 | if (writeConcern.w != null) wc.w = writeConcern.w; |
| 122 | if (writeConcern.wtimeoutMS != null) wc.wtimeout = writeConcern.wtimeoutMS; |
| 123 | if (writeConcern.journal != null) wc.j = writeConcern.j; |
| 124 | command.writeConcern = wc; |
| 125 | return command; |
| 126 | } |
| 127 | |
| 128 | /** Construct a WriteConcern given an options object. */ |
| 129 | static fromOptions( |
no outgoing calls