mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
mongo - using ejson
This commit is contained in:
@@ -31,14 +31,15 @@
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bson": "^6.8.0",
|
||||
"dbgate-plugin-tools": "^1.0.7",
|
||||
"dbgate-query-splitter": "^4.10.1",
|
||||
"lodash": "^4.17.21",
|
||||
"webpack": "^5.91.0",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"dbgate-tools": "^5.0.0-alpha.1",
|
||||
"is-promise": "^4.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mongodb": "^6.3.0",
|
||||
"mongodb-client-encryption": "^6.0.0"
|
||||
"mongodb-client-encryption": "^6.0.0",
|
||||
"webpack": "^5.91.0",
|
||||
"webpack-cli": "^5.1.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ const stream = require('stream');
|
||||
const isPromise = require('is-promise');
|
||||
const driverBase = require('../frontend/driver');
|
||||
const Analyser = require('./Analyser');
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
const ObjectId = require('mongodb').ObjectId;
|
||||
const AbstractCursor = require('mongodb').AbstractCursor;
|
||||
const { MongoClient, ObjectId, AbstractCursor } = require('mongodb');
|
||||
const { EJSON } = require('bson');
|
||||
const createBulkInsertStream = require('./createBulkInsertStream');
|
||||
const {
|
||||
convertToMongoCondition,
|
||||
@@ -14,9 +13,7 @@ const {
|
||||
} = require('../frontend/convertToMongoCondition');
|
||||
|
||||
function transformMongoData(row) {
|
||||
return _.cloneDeepWith(row, (x) => {
|
||||
if (x && x.constructor == ObjectId) return { $oid: x.toString() };
|
||||
});
|
||||
return EJSON.serialize(row);
|
||||
}
|
||||
|
||||
async function readCursor(cursor, options) {
|
||||
@@ -27,11 +24,7 @@ async function readCursor(cursor, options) {
|
||||
}
|
||||
|
||||
function convertObjectId(condition) {
|
||||
return _.cloneDeepWith(condition, (x) => {
|
||||
if (x && x.$oid) {
|
||||
return ObjectId.createFromHexString(x.$oid);
|
||||
}
|
||||
});
|
||||
return EJSON.deserialize(condition);
|
||||
}
|
||||
|
||||
function findArrayResult(resValue) {
|
||||
|
||||
Reference in New Issue
Block a user