Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 34a1512baa
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (18 sloc) 0.511 kb
Example usage
-------------
package main
import "mongo"
func main() {
conn, _ := mongo.Connect("127.0.0.1")
collection := conn.GetDB("test").GetCollection("test_collection")
doc, _ := mongo.Marshal(map[string]string{
"_id": "doc1",
"title": "A Mongo document",
"content": "Testing, 1. 2. 3.",
})
collection.Insert(doc)
query, _ := mongo.Marshal(map[string]string{"_id": "doc1"})
got, _ := collection.FindOne(query)
mongo.Equal(doc, got) // true!
collection.Drop()
}
Jump to Line
Something went wrong with that request. Please try again.