* Does an insert or upsert for an update. If the original query was for an object_id * Does an InsertOrReplace. Otherwise does an Insert to fail if there's an object_id * constraint that fails. */
| 702 | * constraint that fails. |
| 703 | */ |
| 704 | static inline void |
| 705 | DoInsertForUpdate(MongoCollection *collection, uint64_t shardKeyHash, pgbson *objectId, |
| 706 | pgbson *newDocument, bool hasOnlyObjectIdFilter, |
| 707 | const bson_value_t *updateSpecValue) |
| 708 | { |
| 709 | if (hasOnlyObjectIdFilter) |
| 710 | { |
| 711 | InsertOrReplaceDocument(collection->collectionId, collection->shardTableName, |
| 712 | shardKeyHash, objectId, newDocument, updateSpecValue); |
| 713 | } |
| 714 | else |
| 715 | { |
| 716 | InsertDocument(collection->collectionId, collection->shardTableName, |
| 717 | shardKeyHash, objectId, newDocument); |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | |
| 722 | /* |
no test coverage detected