Skip to content

mikejs/gomongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gomongo

Go driver for mongodb.

Installation

The easiest way to install is through goinstall, which will automaticall install dependencies:

$ [sudo -E] goinstall github.com/mikejs/gomongo/mongo

Example usage

package main

import "github.com/mikejs/gomongo/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()
}

About

Go driver for MongoDB

Resources

License

Unknown, BSD-3-Clause licenses found

Licenses found

Unknown
LICENSE
BSD-3-Clause
LICENSE.GO

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages