(result, operation)
| 520 | } |
| 521 | |
| 522 | function extractCrudResult(result, operation) { |
| 523 | if (Array.isArray(result) || !isRecord(result)) { |
| 524 | return result; |
| 525 | } |
| 526 | |
| 527 | if (result.value) { |
| 528 | // some of our findAndModify results return more than just an id, so we need to pluck |
| 529 | const resultKeys = Object.keys(operation.result); |
| 530 | if (resultKeys.length === 1 && resultKeys[0] === '_id') { |
| 531 | return { _id: result.value._id }; |
| 532 | } |
| 533 | |
| 534 | return result.value; |
| 535 | } |
| 536 | |
| 537 | return operation.result; |
| 538 | } |
| 539 | |
| 540 | function isTransactionCommand(command) { |
| 541 | return ['startTransaction', 'commitTransaction', 'abortTransaction'].indexOf(command) !== -1; |
no test coverage detected