Updating documents #12

Closed
opened 2026-08-05 17:20:43 +02:00 by c.fahner · 1 comment
Owner

The design of Collection::startUpdate() is not yet complete.

The update command should require a filter upfront to minimize the chances of accidentally applying it to all documents/records.

The design of `Collection::startUpdate()` is not yet complete. The update command should require a filter upfront to minimize the chances of accidentally applying it to all documents/records.
c.fahner added this to the v0.1 milestone 2026-08-05 17:20:43 +02:00
Author
Owner

The command should also require a non-empty-list of update statements upfront. An update command without any updates does not make sense.

Update statements are implemented in a similar manner as Predicate expressions are now, except they are statements to be processed on a document sequentially instead of expressionlike constructs.

The "upsert" option is out of scope for the initial version of this command. Most likely this will have to be implemented as its own startUpsert():Command method as part of a separate interface for Collection's, as not all databases use the same semantics when it comes to upserting. For example, SQL databases tend to require a unique index conflict whereas MongoDB allows any query that does not match. An additional question is whether to allow a multidocument upsert (the update command is multidocument by default).

The command should also require a `non-empty-list` of update statements upfront. An update command without any updates does not make sense. Update statements are implemented in a similar manner as `Predicate` expressions are now, except they are statements to be processed on a document sequentially instead of expressionlike constructs. The "upsert" option is out of scope for the initial version of this command. Most likely this will have to be implemented as its own `startUpsert():Command` method as part of a separate interface for `Collection`'s, as not all databases use the same semantics when it comes to upserting. For example, SQL databases tend to require a unique index conflict whereas MongoDB allows any query that does not match. An additional question is whether to allow a multidocument upsert (the update command is multidocument by default).
c.fahner added spent time 2026-08-17 18:01:13 +02:00
20 minutes
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 20 minutes
c.fahner
20 minutes
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
Reference
slendium/ocd#12
No description provided.