1. Daniel Smith
  2. gomongo

Source

gomongo /

Filename Size Date modified Message
1.4 KB
1.6 KB
123 B
440 B
13.9 KB
7.5 KB
4.6 KB
12.8 KB
8.1 KB
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();