Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A MongoDB driver for Go
tree: 9969fbc2bf

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
LICENSE
Makefile
README.md
collection.go
conn.go
cursor.go
database.go
query.go

README.md

Mongogo

Mongogo is a MongoDB driver for the Go programming language.

This project is still in development. It's not well tested, but the basics seem to work well enough.

Dependencies

Mongogo's sole external dependency is Go-BSON.

You can install it with goinstall by running goinstall github.com/edsrzf/go-bson

Usage

Create a connection:

conn := mongo.Dial("127.0.0.1:27017")

Get a database:

db := conn.Database("blog")

Get a collection:

col := db.Collection("posts")

Insert a document into the collection:

doc := map[string]interface{}{"title": "Hello", "body": "World!"}
col.Insert(doc)

Query the database:

q := mongo.Query{"title": "Hello"}
cursor := col.Find(q, 0, 0)
defer cursor.Close()

See the documentation in the source for more information.

Contributing

Simply use GitHub as usual to create a fork, make your changes, and create a pull request. Code is expected to be formatted with gofmt and to adhere to the usual Go conventions -- that is, the conventions used by Go's core libraries.

Something went wrong with that request. Please try again.