Просмотр исходного кода

ensure to take a snapshot when exporting

Yuki Takei 6 лет назад
Родитель
Сommit
36d7dde61e
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/server/service/export.js

+ 1 - 1
src/server/service/export.js

@@ -118,7 +118,7 @@ class ExportService {
     const { collectionName } = Model.collection;
     const { collectionName } = Model.collection;
     const jsonFileToWrite = path.join(this.baseDir, `${collectionName}.json`);
     const jsonFileToWrite = path.join(this.baseDir, `${collectionName}.json`);
     const writeStream = fs.createWriteStream(jsonFileToWrite, { encoding: this.growiBridgeService.getEncoding() });
     const writeStream = fs.createWriteStream(jsonFileToWrite, { encoding: this.growiBridgeService.getEncoding() });
-    const readStream = Model.find().stream({ transform: JSON.stringify });
+    const readStream = Model.find().snapshot().stream({ transform: JSON.stringify });
     const total = await Model.countDocuments();
     const total = await Model.countDocuments();
     // const getLogText = (n, total) => `${collectionName}: ${n}/${total} written`;
     // const getLogText = (n, total) => `${collectionName}: ${n}/${total} written`;
     const getLogText = undefined;
     const getLogText = undefined;