1602 / 1602/jugglingdb

make batch write "all or nothing"

Abierto
#400 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
2k
Forks
238
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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()`).

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.