Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion forward_engineering/helpers/applyToInstanceHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const applyToInstanceHelper = {
try {
logger.clear();
log.info(getSystemInfo(connectionInfo.appVersion));
log.info(connectionInfo);
log.info(connectionInfo, 'connectionInfo');

await connectionHelper.connect(connectionInfo, sshService);
connectionHelper.close(sshService);
Expand Down
4 changes: 2 additions & 2 deletions reverse_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
try {
logger.clear();
log.info(getSystemInfo(connectionInfo.appVersion));
log.info(connectionInfo);
log.info(connectionInfo, 'connectionInfo');

await connectionHelper.connect(connectionInfo, sshService);

Expand Down Expand Up @@ -58,7 +58,7 @@ module.exports = {

logger.clear();
log.info(getSystemInfo(connectionInfo.appVersion));
log.info(connectionInfo);
log.info(connectionInfo, 'connectionInfo');

const includeSystemCollection = connectionInfo.includeSystemCollection;
const connection = await connectionHelper.connect(connectionInfo, sshService);
Expand Down
4 changes: 2 additions & 2 deletions shared/logHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const toTime = number => {

const createLogger = ({ title, logger, hiddenKeys }) => {
return {
info(message) {
logger.log('info', { message }, title, hiddenKeys);
info(message, infoTitle) {
logger.log('info', message, infoTitle || title, hiddenKeys);
},

progress(message, dbName = '', tableName = '') {
Expand Down
13 changes: 10 additions & 3 deletions shared/mongoDbClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,24 @@ const createConnection = ({ connection }) => {
});
};

const getCountByDirectCommand = ({ db, collectionName, scale = 1000000 }) =>
db.command({ collStats: collectionName, scale }).catch(err => Promise.reject(getError(err)));

const getCount = (dbName, collectionName) => {
return new Promise((resolve, reject) => {
const db = connection.db(dbName);
const collection = db.collection(collectionName);

collection.estimatedDocumentCount((err, count) => {
if (err) {
return reject(getError(err));
} else {
if (!err) {
return resolve(count);
}

if (err.message.includes('Unrecognized pipeline stage name: $collStats')) {
return getCountByDirectCommand({ db, collectionName }).then(resolve).catch(reject);
}

return reject(getError(err));
});
});
};
Expand Down