mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 13:46:00 +00:00
precise work with mongoid
This commit is contained in:
@@ -3,11 +3,9 @@ const { driverBase } = global.DBGATE_TOOLS;
|
||||
const Dumper = require('./Dumper');
|
||||
const { mongoSplitterOptions } = require('dbgate-query-splitter/lib/options');
|
||||
|
||||
const mongoIdRegex = /^[0-9a-f]{24}$/;
|
||||
|
||||
function getConditionPreview(condition) {
|
||||
if (condition && _isString(condition._id) && condition._id.match(mongoIdRegex)) {
|
||||
return `{ _id: { $in: ['${condition._id}', ObjectId('${condition._id}')] } }`;
|
||||
if (condition && condition._id && condition._id.$oid) {
|
||||
return `{ _id: ObjectId('${condition._id.$oid}') }`;
|
||||
}
|
||||
return JSON.stringify(condition);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user