Documentation
¶
Index ¶
- func GetAddress() (ipport string, network string)
- func GetIPaddress() string
- func GetOneDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T, err error)
- func GetRandomDoc[T any](db *mongo.Database, collection string, size uint) (result []T, err error)
- func MongoConnect(mconn models.DBInfo) (db *mongo.Database, err error)
- func PostStructWithToken[T any](tokenkey string, tokenvalue string, structname interface{}, urltarget string) (result T, err error)
- func ReplaceOneDoc(db *mongo.Database, collection string, filter bson.M, doc interface{}) (updatereseult *mongo.UpdateResult, err error)
- func SRVLookup(srvuri string) (mongouri string)
- func UpdateDoc(db *mongo.Database, collection string, filter bson.M, updatefield bson.M) (updateresult *mongo.UpdateResult, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAddress ¶
func GetIPaddress ¶
func GetIPaddress() string
func GetRandomDoc ¶
func PostStructWithToken ¶
func ReplaceOneDoc ¶
func UpdateDoc ¶
func UpdateDoc(db *mongo.Database, collection string, filter bson.M, updatefield bson.M) (updateresult *mongo.UpdateResult, err error)
With replaceOne() you can only replace the entire document, while updateOne() allows for updating fields. Since replaceOne() replaces the entire document - fields in the old document not contained in the new will be lost. With updateOne() new fields can be added without losing the fields in the old document.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.