Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

> You can try the snapshot API: https://blocksuite.io/guide/data-synchronization.html#snapshot-api #6914

Open
undefined-unknown opened this issue Apr 29, 2024 · 0 comments
Labels
mod:import-export Related to file importing and exporting type:question Question about framework usage

Comments

@undefined-unknown
Copy link

undefined-unknown commented Apr 29, 2024

You can try the snapshot API: https://blocksuite.io/guide/data-synchronization.html#snapshot-api

Thanks for the answer!
One problem here is that I am doing const json = await job.docToSnapshot(doc); to store json in sql. I will do it again the next time I retrieve it.

const schema = new Schema().register(AffineSchemas);
const collection = new DocCollection({ schema });
const job = new Job({ collection });
const doc = await job.snapshotToDoc(docSnapshot);
doc.load();

Such an operation is not allowed because doc.meta.tags is not in the new collection instance. In this case, should I store it twice? That is

const collectionSnapshot = await job.collectionInfoToSnapshot();

Do it first the next time you use it

const schema = new Schema().register(AffineSchemas);
const collection = new DocCollection({ schema });
const job = new Job({ collection });
job.snapshotToCollectionInfo(_collectionSnapshot);
const doc = await job.snapshotToDoc(docSnapshot);
doc.load();

Originally posted by @undefined-unknown in #6911 (comment)

@Flrande Flrande added mod:import-export Related to file importing and exporting type:question Question about framework usage labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod:import-export Related to file importing and exporting type:question Question about framework usage
Projects
Status: No status
Development

No branches or pull requests

2 participants