make batch write "all or nothing"
- Lingua principale
- JavaScript
- Stelle
- 2k
- Fork
- 238
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Currently, the batch write mode is nothing but a grammar sugar, not really taking advantage of any adapter's batch write method.
To ensure errors are properly handled, one still need to write array iterations in the callback. If you want to retry creation with existing data, you'd have to remove successfully created objects (otherwise duplicates happen).
The currently behavior `callback([, Error, ], [Object, null, Object])` breaks "all or nothing" principle for atomicity, make it difficult to trace Error (you have to print an array, or do iteration), and breaks API consistency (image you accidentally passed an Array to Model.create when you need it to be an object).
To avoid confusions and headaches, this mode should either be 1). removed, as it's not really "bulk inserting", 2). made atomic (at lease validate them all before starting to `save()`).
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Look at the batch write implementation in the codebase, likely in the ORM's core or adapter layer. Examine how Model.create handles arrays and the current error handling. The goal is to modify the batch operation to be atomic, either by validating all records before saving or by using the adapter's native batch methods. Testing will involve creating and running tests for batch writes with error scenarios.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- databases, javascript, node.js
- Ambito
- backend, databases
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100