#373 fixed mongodb export

This commit is contained in:
Jan Prochazka
2022-09-17 09:25:12 +02:00
parent 66f30ff26e
commit 9aded740ca
2 changed files with 6 additions and 3 deletions

View File

@@ -20,7 +20,9 @@ async function queryReader({
const driver = requireEngineDriver(connection); const driver = requireEngineDriver(connection);
const pool = await connectUtility(driver, connection, queryType == 'json' ? 'read' : 'script'); const pool = await connectUtility(driver, connection, queryType == 'json' ? 'read' : 'script');
console.log(`Connected.`); console.log(`Connected.`);
return queryType == 'json' ? await driver.readJsonQuery(pool, query) : await driver.readQuery(pool, query || sql); const reader =
queryType == 'json' ? await driver.readJsonQuery(pool, query) : await driver.readQuery(pool, query || sql);
return reader;
} }
module.exports = queryReader; module.exports = queryReader;

View File

@@ -179,7 +179,7 @@ const driver = {
exprValue = func(db, ObjectId); exprValue = func(db, ObjectId);
// return directly stream without header row // return directly stream without header row
return exprValue; return exprValue.stream();
// pass.write(structure || { __isDynamicStructure: true }); // pass.write(structure || { __isDynamicStructure: true });
// exprValue.on('data', (row) => pass.write(row)); // exprValue.on('data', (row) => pass.write(row));
@@ -331,7 +331,8 @@ const driver = {
const res = db const res = db
.collection(collection) .collection(collection)
.find(condition || {}) .find(condition || {})
.sort(sort || {}); .sort(sort || {})
.stream();
return res; return res;
}, },