Code Monkey home page Code Monkey logo

mongodb-with-golang's Introduction

mongodb-with-golang

MongoDB Quick Start with Golang

  # 起動コマンド
$ docker-compose up -d
  # 停止させるコマンド
$ docker-compose down

https://www.mongodb.com/docs/drivers/go/current/quick-start/

https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo

  • bson.M(BSON Map):

MongoDBのドキュメントを表現するためのマップ(連想配列)の一種 キーと値のペアを含むデータを表現 キーは文字列で、値はさまざまなデータ型になる

doc := bson.M{
    "name":  "hogehoge",
    "age":   30,
    "email": "[email protected]",
}
  • bson.D(BSON Document):

MongoDBのドキュメントを表現するためのドキュメント(ディクショナリ)の一種 キーと値のペアを持ち、挿入順に格納 キーは文字列で、値はさまざまなデータ型になる bson.M と異なり、挿入順が保持されるため、順序が重要な場合に使用

doc := bson.D{
    {"name", "hogehoge"},
    {"age", 30},
    {"email", "[email protected]"},
}

mongodb-with-golang's People

Contributors

kushidam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.