Registry / database / mgo-v2

mgo-v2

JSON →
library2.0.0-20190816093944-a6b53ec6cb22gogounverified

Package mgo offers a rich MongoDB driver for Go, providing high-level and low-level database operations.

go get gopkg.in/mgo.v2
INSTALL
IMPORT
SIG · MGO-V2
M
mgo-v2
databasegov2.0.0-20190816093944-a6b53ec6cb22
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mgo
gopkg.in/mgo.v2

Connects to MongoDB, queries a document from the 'people' collection.

package main import ( "fmt" "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" ) func main() { session, err := mgo.Dial("localhost") if err != nil { panic(err) } defer session.Close() c := session.DB("test").C("people") result := struct{ Name string }{} c.Find(bson.M{"name": "Alice"}).One(&result) fmt.Println(result.Name) }
Debug
Known issues
breakingmgo v2 is unmaintained; consider using the official MongoDB Go driver.
fix
Migrate to go.mongodb.org/mongo-driver.
affects: all
Upgrade
Version history
2.0.0-20190816093944-a6b53ec6cb22latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
mgo-v2 — go get mgo-v2 · libregistry