From e88cbd96e372ad24c97a36bfb8507fc81545e760 Mon Sep 17 00:00:00 2001 From: Tim Fogarty Date: Mon, 18 Mar 2019 13:34:02 +0100 Subject: [PATCH] Upgrade to 1.0.0 --- Gopkg.lock | 16 ++++++++-------- Gopkg.toml | 2 +- README.md | 10 ++++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 2d3a6b0..84e16a8 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -11,11 +11,11 @@ [[projects]] branch = "master" - digest = "1:4a0c6bb4805508a6287675fac876be2ac1182539ca8a32468d8128882e9d5009" + digest = "1:e4f5819333ac698d294fe04dbf640f84719658d5c7ce195b10060cc37292ce79" name = "github.com/golang/snappy" packages = ["."] pruneopts = "UT" - revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a" + revision = "2a8bb927dd31d8daada140a5d09578521ce5c36a" [[projects]] branch = "master" @@ -34,7 +34,7 @@ revision = "73f8eece6fdcd902c185bf651de50f3828bed5ed" [[projects]] - digest = "1:7280a69811fe89d769f5cbbee7ec10cc33488d1e0d573c6d65e35a8887ab3420" + digest = "1:21f9cb6f1337c4776ed1d2d7b7ed6ffba3269ca12274c065364a5c0edee1f28b" name = "go.mongodb.org/mongo-driver" packages = [ "bson", @@ -69,8 +69,8 @@ "x/network/wiremessage", ] pruneopts = "UT" - revision = "ccf36d0607fa2f6f4ae9645e625a7f33b26cf6d1" - version = "v1.0.0-rc1" + revision = "1c3b9b9a41eecdf056560e07b68e6407b8d598c3" + version = "v1.0.0" [[projects]] branch = "master" @@ -78,15 +78,15 @@ name = "golang.org/x/crypto" packages = ["pbkdf2"] pruneopts = "UT" - revision = "505ab145d0a99da450461ae2c1a9f6cd10d1f447" + revision = "a1f597ede03a7bef967a422b5b3a5bd08805a01e" [[projects]] branch = "master" - digest = "1:5e4d81c50cffcb124b899e4f3eabec3930c73532f0096c27f94476728ba03028" + digest = "1:75515eedc0dc2cb0b40372008b616fa2841d831c63eedd403285ff286c593295" name = "golang.org/x/sync" packages = ["semaphore"] pruneopts = "UT" - revision = "42b317875d0fa942474b76e1b46a6060d720ae6e" + revision = "e225da77a7e68af35c70ccbf71af2b83e6acac3c" [[projects]] digest = "1:8029e9743749d4be5bc9f7d42ea1659471767860f0cdc34d37c3111bd308a295" diff --git a/Gopkg.toml b/Gopkg.toml index e2acbc8..a6a01aa 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -32,4 +32,4 @@ [[constraint]] name = "go.mongodb.org/mongo-driver" - version = "1.0.0-rc1" + version = "1.0.0" diff --git a/README.md b/README.md index 7bd157b..91a31cd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MongoDB Go Driver Tutorial Part 1: Connecting, Using BSON, and CRUD Operations -With the official MongoDB Go Driver [recently moving to beta](https://www.mongodb.com/blog/post/official-mongodb-go-driver-now-available-for-beta-testing), it's now regarded as feature complete and ready for a wider audience to start using. This tutorial will help you get started with the [MongoDB Go Driver](https://github.com/mongodb/mongo-go-driver/). You will create a simple program and learn how to: +The official MongoDB Go Driver [recently moved to GA](#) with the release of version 1.0.0. It's now regarded as feature complete and ready for production use. This tutorial will help you get started with the [MongoDB Go Driver](https://github.com/mongodb/mongo-go-driver/). You will create a simple program and learn how to: - Install the MongoDB Go Driver - Connect to MongoDB using the Go Driver @@ -17,7 +17,7 @@ The MongoDB Go Driver is made up of several packages. If you are just using `go go get go.mongodb.org/mongo-driver ``` -The output of this may look like a warning stating something like `package go.mongodb.org/mongo-driver: no Go files in (...)`. This is expected output. +The output of this may look like a warning stating something like `package go.mongodb.org/mongo-driver: no Go files in (...)`. This is expected output from `go get`. If you are using the [`dep`](https://golang.github.io/dep/docs/introduction.html) package manager, you can install the main `mongo` package as well as the `bson` and `mongo/options` package using this command: @@ -27,6 +27,8 @@ go.mongodb.org/mongo-driver/bson \ go.mongodb.org/mongo-driver/mongo/options ``` +If you are using [`go mod`](https://github.com/golang/go/wiki/Modules), the correct packages should be retrieved at build time. + ## Create the wireframe Create the file `main.go` and import the `bson`, `mongo`, and `mongo/options` packages: @@ -109,7 +111,7 @@ Run the code (`go run main.go`) to test that your program can successfully conne ## Use BSON Objects in Go -JSON documents in MongoDB are stored in a binary representation called BSON (Binary-encoded JSON). Unlike other databases that store JSON data as simple strings and numbers, the BSON encoding extends the JSON representation to include additional types such as int, long, date, floating point, and decimal128. This makes it much easier for applications to reliably process, sort, and compare data. The Go Driver has two families of types for representing BSON data: The `D` types and the `Raw` types. +Before we start sending queries to the database, it's important to understand how the Go Driver works with BSON objects. JSON documents in MongoDB are stored in a binary representation called BSON (Binary-encoded JSON). Unlike other databases that store JSON data as simple strings and numbers, the BSON encoding extends the JSON representation to include additional types such as int, long, date, floating point, and decimal128. This makes it much easier for applications to reliably process, sort, and compare data. The Go Driver has two families of types for representing BSON data: The `D` types and the `Raw` types. The `D` family of types is used to concisely build BSON objects using native Go types. This can be particularly useful for constructing commands passed to MongoDB. The `D` family consists of four types: @@ -265,6 +267,6 @@ fmt.Printf("Deleted %v documents in the trainers collection\n", deleteResult.Del ## Next steps -You can view the final code from this tutorial in [this GitHub repository](https://github.com/tfogo/mongodb-go-tutorial). Documentation for the MongoDB Go Driver is available on [GoDoc](https://godoc.org/github.com/mongodb/mongo-go-driver). You may be particularly interested in the documentation about using [aggregations](https://godoc.org/go.mongodb.org/mongo-driver/mongo#Collection.Aggregate) or [transactions](https://godoc.org/go.mongodb.org/mongo-driver/mongo#Session). +You can view the final code from this tutorial in [this GitHub repository](https://github.com/tfogo/mongodb-go-tutorial). Documentation for the MongoDB Go Driver is available on [GoDoc](https://godoc.org/go.mongodb.org/mongo-driver). You may be particularly interested in the documentation about using [aggregations](https://godoc.org/go.mongodb.org/mongo-driver/mongo#Collection.Aggregate) or [transactions](https://godoc.org/go.mongodb.org/mongo-driver/mongo#Session). If you have any questions, please get in touch in the [mongo-go-driver Google Group](https://groups.google.com/forum/#!forum/mongodb-go-driver). Please file any bug reports on the Go project in the [MongoDB JIRA](https://www.google.com/url?q=https%3A%2F%2Fjira.mongodb.org%2Fprojects%2FGODRIVER&sa=D&sntz=1&usg=AFQjCNEOEt6d3ZNOMKzmT23RYOVYdjSD6g). We would love your feedback on the Go Driver, so please get in touch with us to let us know your thoughts.