Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Go driver for MongoDB
Go
tree: 67ec2b8208

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
LICENSE
LICENSE.GO
Makefile
README
bson.go
bson_struct.go
bson_test.go
mongo.go
mongo_test.go

README

Example usage:

import "mongo"

doc, _ := mongo.Marshal(map[string]string{"_id": "doc1", "title": "A Mongo document", "content": "Testing, 1. 2. 3."});
conn, _ := mongo.Connect("127.0.0.1", 27017);
collection := conn.GetDB("test").GetCollection("test_collection");
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.