mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 06:46:00 +00:00
fixed mongo update condition
This commit is contained in:
@@ -21,7 +21,9 @@ const mongoIdRegex = /^[0-9a-f]{24}$/;
|
||||
function convertConditionInternal(condition) {
|
||||
if (condition && _.isString(condition._id) && condition._id.match(mongoIdRegex)) {
|
||||
return {
|
||||
_id: ObjectId(condition._id),
|
||||
_id: {
|
||||
$in: [condition._id, ObjectId(condition._id)],
|
||||
},
|
||||
};
|
||||
}
|
||||
return condition;
|
||||
|
||||
@@ -7,7 +7,7 @@ const mongoIdRegex = /^[0-9a-f]{24}$/;
|
||||
|
||||
function getConditionPreview(condition) {
|
||||
if (condition && _isString(condition._id) && condition._id.match(mongoIdRegex)) {
|
||||
return `{ _id: ObjectId('${condition._id}') }`;
|
||||
return `{ _id: { $in: ['${condition._id}', ObjectId('${condition._id}')] } }`;
|
||||
}
|
||||
return JSON.stringify(condition);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user