From c56e26fbfb507ebf6f98e91fb4f1a8714cdbfcc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Nieto?= <xiam@menteslibres.org>
Date: Sun, 2 Dec 2012 14:18:41 -0600
Subject: [PATCH] Adding full example

---
 README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/README.md b/README.md
index 3cd8c25c..625a28d5 100644
--- a/README.md
+++ b/README.md
@@ -103,6 +103,69 @@ for _, item := range items {
 The same example goes for other drivers with few modifications, just change the driver name to
 `mysql`, `postgresql` or `sqlite`.
 
+### Full example
+
+```go
+# _examples/mongo.go
+package main
+
+import (
+	"fmt"
+	"github.com/gosexy/db"
+	_ "github.com/gosexy/db/mongo"
+	"github.com/gosexy/sugar"
+)
+
+const host = "debian"
+const dbname = "dev"
+
+func main() {
+
+	sess, err := db.Open("mongo", db.DataSource{Host: host, Database: dbname})
+
+	if err != nil {
+		panic(err)
+	}
+
+	defer sess.Close()
+
+	sess.Drop()
+
+	animals, _ := sess.Collection("animals")
+
+	animals.Append(db.Item{
+		"animal": "Bird",
+		"young":  "Chick",
+		"female": "Hen",
+		"male":   "Cock",
+		"group":  "flock",
+	})
+
+	animals.Append(db.Item{
+		"animal": "Bovidae",
+		"young":  "Calf",
+		"female": "Cow",
+		"male":   "Bull",
+		"group":  "Herd",
+	})
+
+	animals.Append(db.Item{
+		"animal": "Canidae",
+		"young":  sugar.List{"Puppy", "Pup"},
+		"female": "Bitch",
+		"male":   "Dog",
+		"group":  "Pack",
+	})
+
+	items := animals.FindAll()
+
+	for _, item := range items {
+		fmt.Printf("animal: %s, young: %s\n", item["animal"], item["young"])
+	}
+
+}
+```
+
 ## Documentation
 
 To know how to query the database you've just connected, please read the [online reference](http://gosexy.org/db).
-- 
GitLab