{"repo":"go-pkgz/mongo","free":true,"listed":false,"github":"https://github.com/go-pkgz/mongo","clone":"git clone https://github.com/go-pkgz/mongo.git","description":"mongo db wrapper on top of mongo-driver","language":"Go","stars":13,"topics":["golang","mongodb","library"],"license":"MIT","category":"data-pipelines","readme_excerpt":"Mongo Provides helpers on top of mongo-go-driver Version 2, for the official mongo-go-driver note: version 1 (mgo based) is deprecated - Install and update - go get -u github.com/go-pkgz/mongo/v2 - Connect - Connects with mongo url and return mongo client. Supports extra url params to pass a set of custom values in the url, for example \"mongodb://127.0.0.1:27017/test?debug=true&foo=bar . Connect returns mongo.Client as well as the map with all extra key/values. After connect call it also tries to ping the mongo server. - BufferedWriter implements buffered writer to mongo. Write method caching internally till it reached buffer size. Flush methods can be called manually at any time. - WithCollection sets collection name to write to - WithAutoFlush sets auto flush duration - PrepSort - prepares sort object bson.D from strings like \"a,-b\" - PrepIndex - prepares index object driver.IndexModel from strings like \"a,-b\" Testing - mongo.MakeTestConnection creates mongo.Client and mongo.Collection for url defined in env MONGO TEST . If not defined mongodb://mongo:27017 used. By default it will use random connection with prefix test in test DB. - MakeTestConnectionWithColl creates mongo.Client and mongo.Collection with a custom collection name. Both methods return mongo.Client and mongo.Collection which can be used for testing. It also returns teardown func to clean mongo after the test.","default_branch":null,"files":null,"tree":[],"storefront":"/r/go-pkgz","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/go-pkgz/mongo/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}