| 1234567891011121314151617181920212223 | package moimport (	"go.mongodb.org/mongo-driver/mongo/options")// NewJsonSchema// reference https://docs.mongodb.com/manual/reference/command/collMod/#mongodb-collflag-validatorfunc NewJsonSchema(collName string, jsonSchema M) D {	return D{{Key: "collMod", Value: collName}, {"validator", E{Key: "$jsonSchema", Value: jsonSchema}}}}// NewIndex create index list from fieldfunc NewIndex(field []string) []IndexModel {	index := make([]IndexModel, len(field))	for i := 0; i < len(field); i++ {		index[i] = IndexModel{			Keys: M{field[i]: 1},			Options: options.Index().SetUnique(true),		}	}	return index}
 |