Categorygithub.com/daydzen/backendsandboxgolang-udemy-cours042_mongodb05_mongodb03_update-user-controllers-post
package
0.0.0-20210507123535-945c2a7f8e6a
Repository: https://github.com/daydzen/backendsandbox.git
Documentation: pkg.go.dev
# README
Don't run this code yet
We create an ObjectId using the bson package.
We do this in controllers/user.go in func CreateUser
// create bson ID
u.Id = bson.NewObjectId()
Second, we store the user in mongodb.
We do this in controllers/user.go in func CreateUser
uc.session.DB("go-web-dev-db").C("users").Insert(u)