All Projects → amorist → mango

amorist / mango

Licence: MIT license
Use mongo-go-driver like mgo

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to mango

Lua Mongo
MongoDB Driver for Lua
Stars: ✭ 81 (+118.92%)
Mutual labels:  mongo, mongodb-driver
Avocado
Strongly-typed MongoDB driver for Rust
Stars: ✭ 70 (+89.19%)
Mutual labels:  mongo, mongodb-driver
Aspnetcore.identity.mongo
This is a MongoDB provider for the ASP.NET Core 2 Identity framework
Stars: ✭ 179 (+383.78%)
Mutual labels:  mongo
mongo-rust-driver
Mongo Rust driver built on top of the Mongo C driver
Stars: ✭ 89 (+140.54%)
Mutual labels:  mongo
nestjs-api-mongoose
Collection example apps with NestJS and Typeorm, Sequelize, Mongodb, PostgreSQL, MySQL, GraphQL, Mercurius, etc. for the NestJS community 😻
Stars: ✭ 153 (+313.51%)
Mutual labels:  mongo
Mern Passport
A boilerplate example of using passport.js for authenticating a MERN application
Stars: ✭ 214 (+478.38%)
Mutual labels:  mongo
weightless-orm
🛸 A lightweight database mapping library
Stars: ✭ 24 (-35.14%)
Mutual labels:  mongo
Mongo Cluster Docker
Docker compose config for mongodb cluster
Stars: ✭ 165 (+345.95%)
Mutual labels:  mongo
pymongo inmemory
A mongo mocking library with an ephemeral MongoDB running in memory.
Stars: ✭ 25 (-32.43%)
Mutual labels:  mongo
MongoDB-University
Repo for All MongoDB University Courses
Stars: ✭ 102 (+175.68%)
Mutual labels:  mongo
polymorphia
A very fast POJO codec for MongoDB (used in conjunction with the Mongo Java Driver) that handles generic types as well as polymorphic class hierarchies
Stars: ✭ 21 (-43.24%)
Mutual labels:  mongo
docker-mongo
MongoDB Docker image embedding RocksDB storage engine
Stars: ✭ 32 (-13.51%)
Mutual labels:  mongo
Flipper
🐬 Beautiful, performant feature flags for Ruby.
Stars: ✭ 2,732 (+7283.78%)
Mutual labels:  mongo
ark.db
Small and fast JSON database for Node and browser. 😋
Stars: ✭ 65 (+75.68%)
Mutual labels:  mongo
Chartbrew
Open-source web platform for creating charts out of different data sources (databases and APIs) 📈📊
Stars: ✭ 199 (+437.84%)
Mutual labels:  mongo
SonataDoctrineMongoDBAdminBundle
Symfony Sonata / Integrate Doctrine MongoDB ODM into the SonataAdminBundle
Stars: ✭ 64 (+72.97%)
Mutual labels:  mongo
Mevn Stack
A Quickstart for building an Express API with a VueJS Admin Portal
Stars: ✭ 178 (+381.08%)
Mutual labels:  mongo
Odmantic
Async ODM (Object Document Mapper) for MongoDB based on python type hints
Stars: ✭ 240 (+548.65%)
Mutual labels:  mongo
BroadcastBot
A simple Telegram bot that can broadcast messages and media to the bot subscribers. with mongo DB support
Stars: ✭ 73 (+97.3%)
Mutual labels:  mongo
sql2mongo
Use SQL to query MongoDB
Stars: ✭ 14 (-62.16%)
Mutual labels:  mongo

mango

图片名称

GoDoc Build Status dependabot FOSSA Status

Use mongo-go-driver like mgo

installation

go get -u github.com/amorist/mango

usage

package main

import (
    "fmt"

    "github.com/amorist/mango"

    "github.com/amorist/mango/bson"
)

// Person person model
type Person struct {
    ID   bson.ObjectID `bson:"_id" json:"_id"`
    Name string        `bson:"name" json:"name"`
}

func main() {
    session := mango.New("mongodb://127.0.0.1")
    session.SetPoolLimit(10)

    if err := session.Connect(); err != nil {
        fmt.Println(err)
        return
    }

    // Find find all
    var result []Person
    if err := session.DB("test").Collection("persons").Find(bson.M{}).All(&result); err != nil {
        fmt.Println(err)
    }

    for _, r := range result {
        fmt.Println(r.Name)
    }

    // Update
    if err := session.DB("test").Collection("persons").Update(bson.M{"name": "name1"}, bson.M{"$set": bson.M{"name": "name2"}}); err != nil {
        fmt.Println(err)
    }

    // Update update all
    info, err := session.DB("test").Collection("persons").UpdateAll(bson.M{"name": "name1"}, bson.M{"$set": bson.M{"name": "name"}})
    if err != nil {
        fmt.Println(err)
    }
    fmt.Println(info)

    // Remove
    if err := session.DB("test").Collection("persons").Remove(bson.M{"name": "name"}); err != nil {
        fmt.Println(err)
    }

    // RemoveAll
    if err := session.DB("test").Collection("persons").RemoveAll(bson.M{"name": "name"}); err != nil {
        fmt.Println(err)
    }

    // Insert
    if err := session.DB("test").Collection("persons").Insert(bson.M{"name": "name"}); err != nil {
        fmt.Println(err)
    }

    // InsertAll
    var docs []interface{}
    for index := 0; index < 10; index++ {
        docs = append(docs, bson.M{"name": index})
    }

    if err := session.DB("test").Collection("persons").InsertAll(docs); err != nil {
        fmt.Println(err)
    }

    // Count
    count, err := session.DB("test").Collection("persons").Count(bson.M{"name": "name"})
    if err != nil {
        fmt.Println(err)
    }
    fmt.Println(count)
}

doc

mango

License

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].