diff --git a/plugins/dbgate-plugin-mongo/src/backend/driver.js b/plugins/dbgate-plugin-mongo/src/backend/driver.js index 756c6a5a..3d6c5a01 100644 --- a/plugins/dbgate-plugin-mongo/src/backend/driver.js +++ b/plugins/dbgate-plugin-mongo/src/backend/driver.js @@ -9,7 +9,9 @@ const AbstractCursor = require('mongodb').AbstractCursor; const createBulkInsertStream = require('./createBulkInsertStream'); function transformMongoData(row) { - return _.mapValues(row, (v) => (v && v.constructor == ObjectId ? { $oid: v.toString() } : v)); + return _.cloneDeepWith(row, (x) => { + if (x && x.constructor == ObjectId) return { $oid: x.toString() }; + }); } async function readCursor(cursor, options) {