Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Go driver for MongoDB

tree: 2fbf335334

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 mongo
Octocat-spinner-32 .gitignore
Octocat-spinner-32 AUTHORS
Octocat-spinner-32 LICENSE
Octocat-spinner-32 LICENSE.GO licensing November 16, 2009
Octocat-spinner-32 README
README
Example usage
-------------

	package main

	import "mongo"


	func main() {
		conn, _ := mongo.Connect("127.0.0.1", 27017)
		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()
	}

Something went wrong with that request. Please try again.