Hi,
I am currently using the exportJSON() and importJSON() database methods to perform manual data migrations in my application.
My database schema uses attachments, and I noticed that the _attachments property is removed from the exported JSON data.
Because of this, importing the dump into another database does not seem to preserve attachment metadata, which makes it impossible to use exportJSON() / importJSON() as a complete database migration mechanism when attachments are involved.
Steps to reproduce
- Create a database with a collection that has attachments enabled.
- Add a document with one or more attachments.
- Run:
const dump = await db.exportJSON();
- Inspect the exported document.
The _attachments field is missing from the exported data.
Expected behavior
The JSON dump should contain the _attachments property so that a complete database export/import cycle can preserve documents together with their attachments.
Current behavior
The _attachments property is removed during export.
Location in the code
|
delete docData._attachments; |
Could you clarify if this is intentional?
If attachments are intentionally excluded from JSON dumps, would it make sense to document this limitation or provide another export/import mechanism that includes attachments?
Thanks!
Hi,
I am currently using the
exportJSON()andimportJSON()database methods to perform manual data migrations in my application.My database schema uses attachments, and I noticed that the
_attachmentsproperty is removed from the exported JSON data.Because of this, importing the dump into another database does not seem to preserve attachment metadata, which makes it impossible to use
exportJSON()/importJSON()as a complete database migration mechanism when attachments are involved.Steps to reproduce
The
_attachmentsfield is missing from the exported data.Expected behavior
The JSON dump should contain the
_attachmentsproperty so that a complete database export/import cycle can preserve documents together with their attachments.Current behavior
The
_attachmentsproperty is removed during export.Location in the code
rxdb/src/plugins/json-dump/index.ts
Line 90 in 265d968
Could you clarify if this is intentional?
If attachments are intentionally excluded from JSON dumps, would it make sense to document this limitation or provide another export/import mechanism that includes attachments?
Thanks!