Skip to content

A Golang MongoDB API to simplify the use of MongoDB in your projects.

License

Notifications You must be signed in to change notification settings

AkmalFairuz/mgx

Repository files navigation

MongoX (mgx)

A Golang MongoDB API to simplify the use of MongoDB in your projects.

Installation

go get github.com/akmalfairuz/mgx

Example Usage

package main

import (
    "fmt"

    "github.com/akmalfairuz/mgx"
)

func main() {
    db, err := mgx.New("mongodb://localhost:27017", "test")
    if err != nil {
        panic(err)
    }
    r := db.Collection("users").Insert(mgx.M{
        "name": "John Doe",
        "age":  20,
    }, mgx.NewInsertOneOptions().BypassDocumentValidation().Comment("John Doe user"))
    if r.Err != nil {
        panic(r.Err)
    }
    fmt.Println(r.InsertedID)
}

About

A Golang MongoDB API to simplify the use of MongoDB in your projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages