Initial import

This commit is contained in:
George Suntres
2026-03-29 11:38:57 -04:00
commit 38265c15d1
25 changed files with 1763 additions and 0 deletions

30
find_one_test.go Normal file
View File

@@ -0,0 +1,30 @@
package mongo
import (
"context"
"testing"
"go.mongodb.org/mongo-driver/v2/bson"
)
func TestFindOne_Default(t *testing.T) {
client := GetMongoClient()
data := map[string]any {
"_id": "su_123459",
"name": "MyNameFindOne",
"age": int32(25),
}
o, err := client.InsertOne(context.Background(), "mydb", "mycollection", data)
if err != nil {
t.Fatalf("Failed to insertOne %#v", err)
}
filter := bson.M{"name": "MyNameFindOne"}
found, err := client.FindOne(context.Background(), "mydb", "mycollection", filter)
if err != nil {
t.Fatalf("Failed to findOne %#v", err)
}
AssertSubset(t, o, found, "Should have been equal")
}