inital commit

This commit is contained in:
2024-12-12 15:55:37 +03:00
commit 13c18e116a
17 changed files with 858 additions and 0 deletions

24
delete.go Normal file
View File

@@ -0,0 +1,24 @@
package main
import (
"context"
"fmt"
"log"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
)
func deleteAllRows(ctx context.Context, coll *mongo.Collection) {
ctx, span := FollowSpan(ctx, "deleteAllRows")
defer span.End()
result, err := coll.DeleteMany(ctx, bson.D{})
if err != nil {
log.Fatal(result)
}
fmt.Println("Remove all documents...")
fmt.Printf("%d documents removed\n", result.DeletedCount)
fmt.Println("=============================")
}