Inserting documents #11

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

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

The insert command should accept any ArrayAcces&Countable&Traversable where field names are non-empty-string and values must be one of the values allowed by Type::serialize() (this must be documented with the Collection::startInsert() method).

The design of `Collection::startInsert()` is not yet complete. The insert command should accept any `ArrayAcces&Countable&Traversable` where field names are `non-empty-string` and values must be one of the values allowed by `Type::serialize()` (this must be documented with the Collection::startInsert() method).
c.fahner added this to the v0.1 milestone 2026-08-05 17:14:22 +02:00
Author
Owner

The insert command requires a non-empty-list of documents as an empty list always suggests a mistake. A list with more than one document automatically implies a bulk insertion.

The list always has to be given upfront. Allowing documents to be added to the command after creating it but before executing it allows the user to create an invalid state (an empty list) which would require runtime checking. This invalid state should be prevented by design.

I see no uses cases for addition of documents after the command has been created. The command should be created on the condition that there is at least one document to insert.

The insert command requires a `non-empty-list` of documents as an empty list always suggests a mistake. A list with more than one document automatically implies a bulk insertion. The list always has to be given upfront. Allowing documents to be added to the command after creating it but before executing it allows the user to create an invalid state (an empty list) which would require runtime checking. This invalid state should be prevented by design. I see no uses cases for addition of documents after the command has been created. The command should be created on the condition that there is at least one document to insert.
c.fahner added spent time 2026-08-17 17:24:57 +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#11
No description provided.