Skip to content

Commit 968eb14

Browse files
committed
copilot sux
1 parent f3b81a8 commit 968eb14

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

mongo/mongo.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func Deserialize(id string, parm string, col string, t reflect.Type) (interface{
125125

126126
collection := client.Database("nettica").Collection(col)
127127

128-
filter := bson.D{{Key: parm, Value: bson.D{{Key: "$eq", Value: id}}}} //bson.D{{Key: parm, Value: id}}
128+
filter := bson.D{{Key: parm, Value: id}}
129129

130130
switch t.String() {
131131

@@ -222,7 +222,7 @@ func Delete(id string, ident string, col string) error {
222222

223223
collection := client.Database("nettica").Collection(col)
224224

225-
filter := bson.D{{Key: ident, Value: bson.D{{Key: "$eq", Value: id}}}}
225+
filter := bson.D{{Key: ident, Value: id}}
226226

227227
collection.FindOneAndDelete(ctx, filter)
228228

@@ -250,7 +250,7 @@ func ReadAllDevices(param string, id string) ([]*model.Device, error) {
250250

251251
filter := bson.D{}
252252
if id != "" {
253-
filter = bson.D{{Key: param, Value: bson.D{{Key: "$eq", Value: id}}}}
253+
filter = bson.D{{Key: param, Value: id}}
254254
}
255255

256256
cursor, err := collection.Find(ctx, filter)
@@ -329,7 +329,7 @@ func ReadDevicesAndVPNsForAccount(accountid string) ([]*model.Device, error) {
329329
// Open an aggregation cursor
330330
coll := client.Database("nettica").Collection("devices")
331331
cursor, err := coll.Aggregate(ctx, bson.A{
332-
bson.D{{Key: "$match", Value: bson.D{{Key: "accountid", Value: bson.D{{Key: "$eq", Value: accountid}}}}}},
332+
bson.D{{Key: "$match", Value: bson.D{{Key: "accountid", Value: accountid}}}},
333333
bson.D{
334334
{Key: "$lookup",
335335
Value: bson.D{
@@ -440,7 +440,7 @@ func ReadAllVPNs(param string, id string) ([]*model.VPN, error) {
440440

441441
filter := bson.D{}
442442
if id != "" {
443-
filter = bson.D{{Key: param, Value: bson.D{{Key: "$eq", Value: id}}}}
443+
filter = bson.D{{Key: param, Value: id}}
444444
}
445445

446446
cursor, err := collection.Find(ctx, filter)
@@ -486,7 +486,7 @@ func ReadAllNetworks(param string, id string) ([]*model.Network, error) {
486486

487487
filter := bson.D{}
488488
if id != "" {
489-
filter = bson.D{{Key: param, Value: bson.D{{Key: "$eq", Value: id}}}}
489+
filter = bson.D{{Key: param, Value: id}}
490490
}
491491

492492
collection := client.Database("nettica").Collection("networks")
@@ -529,7 +529,7 @@ func ReadServices(param string, id string) ([]*model.Service, error) {
529529

530530
filter := bson.D{}
531531
if id != "" {
532-
filter = bson.D{{Key: param, Value: bson.D{{Key: "$eq", Value: id}}}}
532+
filter = bson.D{{Key: param, Value: id}}
533533
}
534534

535535
collection := client.Database("nettica").Collection("services")
@@ -606,7 +606,7 @@ func ReadAllAccounts(email string) ([]*model.Account, error) {
606606

607607
filter := bson.D{}
608608
if email != "" {
609-
filter = bson.D{{Key: "email", Value: bson.D{{Key: "$eq", Value: email}}}}
609+
filter = bson.D{{Key: "email", Value: email}}
610610
}
611611

612612
cursor, err := collection.Find(ctx, filter)
@@ -652,7 +652,7 @@ func ReadAllAccountsForID(id string) ([]*model.Account, error) {
652652
return accounts, nil
653653
}
654654

655-
filter := bson.D{{Key: "parent", Value: bson.D{{Key: "$eq", Value: id}}}}
655+
filter := bson.D{{Key: "parent", Value: id}}
656656

657657
cursor, err := collection.Find(ctx, filter)
658658

@@ -741,7 +741,7 @@ func ReadAllSubscriptions(accountid string) ([]*model.Subscription, error) {
741741

742742
filter := bson.D{}
743743
if accountid != "" {
744-
filter = bson.D{{Key: "accountid", Value: bson.D{{Key: "$eq", Value: accountid}}}}
744+
filter = bson.D{{Key: "accountid", Value: accountid}}
745745
}
746746

747747
cursor, err := collection.Find(ctx, filter)
@@ -785,7 +785,7 @@ func ReadAllServices(accountid string) ([]*model.Service, error) {
785785

786786
filter := bson.D{}
787787
if accountid != "" {
788-
filter = bson.D{{Key: "accountid", Value: bson.D{{Key: "$eq", Value: accountid}}}}
788+
filter = bson.D{{Key: "accountid", Value: accountid}}
789789
}
790790

791791
cursor, err := collection.Find(ctx, filter)
@@ -863,7 +863,7 @@ func ReadServiceHost(id string) ([]*model.Service, error) {
863863

864864
filter := bson.D{}
865865
if id != "" {
866-
filter = bson.D{{Key: "serviceGroup", Value: bson.D{{Key: "$eq", Value: id}}}}
866+
filter = bson.D{{Key: "serviceGroup", Value: id}}
867867
}
868868

869869
cursor, err := collection.Find(ctx, filter)
@@ -913,7 +913,7 @@ func UpsertUser(user *model.User) error {
913913
return err
914914
}
915915

916-
filter := bson.D{{Key: "email", Value: bson.D{{Key: "$eq", Value: user.Email}}}}
916+
filter := bson.D{{Key: "email", Value: user.Email}}
917917

918918
update := bson.M{
919919
"$set": b,

0 commit comments

Comments
 (0)