Update filter for trusted IPs backfill

This commit is contained in:
Tuan Dang
2023-07-26 21:15:07 +07:00
parent 8dbc894ce9
commit 2c021f852f
+8 -9
View File
@@ -570,20 +570,19 @@ export const backfillTrustedIps = async () => {
if (workspaceIdsToAddTrustedIp.length > 0) { if (workspaceIdsToAddTrustedIp.length > 0) {
const operations = workspaceIdsToAddTrustedIp.map((workspaceId) => { const operations = workspaceIdsToAddTrustedIp.map((workspaceId) => {
const update = { return {
updateOne: {
filter: {
workspace: workspaceId,
ipAddress: "0.0.0.0"
},
update: {
workspace: workspaceId, workspace: workspaceId,
ipAddress: "0.0.0.0", ipAddress: "0.0.0.0",
type: IPType.IPV4, type: IPType.IPV4.toString(),
prefix: 0, prefix: 0,
isActive: true, isActive: true,
comment: "" comment: ""
}
return {
updateOne: {
filter: update,
update: {
$setOnInsert: update
}, },
upsert: true, upsert: true,
}, },