| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | package moimport (	"context"	"testing")func TestNewClient(t *testing.T) {	client, err := NewClient("mongodb://root:abcd1234@localhost:27017/?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false")	if err != nil {		t.Error(err)		return	}	ctx, cancel := context.WithTimeout(context.Background(), DefaultTimout)	defer cancel()	// opts := options.CreateCollection().SetValidator(validator)	cmd := D{{Key: "collMod", Value: "user"}, {Key: "validator", Value: E{Key: "$jsonSchema", Value: M{		"bsonType": "object",		"required": []string{"password"},		"properties": M{			"username": M{				"bsonType":    "string",				"description": "must be a string and is required",			},			"password": M{				"bsonType":    "long",				"description": "must be a long and is required",			},		},	}}}}	r := client.Database("ums").RunCommand(ctx, cmd)	if err := r.Err(); err != nil {		t.Error(err)	}}func TestNewObjectID(t *testing.T) {	v := D{}	v = append(v, E{Key: "111", Value: "222"})	t.Log(v)}
 |