mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 04:26:01 +00:00
support remove fields for mongo
This commit is contained in:
@@ -330,7 +330,14 @@ const driver = {
|
||||
}
|
||||
} else {
|
||||
const resdoc = await collection.updateOne(convertObjectId(update.condition), {
|
||||
$set: convertObjectId(update.fields),
|
||||
$set: convertObjectId(_.pickBy(update.fields, (v, k) => !v?.$undefined)),
|
||||
$unset: _.fromPairs(
|
||||
Object.keys(update.fields)
|
||||
.filter((k) => update.fields[k]?.$undefined)
|
||||
.map((k) => [k, ''])
|
||||
),
|
||||
|
||||
// $set: convertObjectId(update.fields),
|
||||
});
|
||||
res.updated.push(resdoc._id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user