Questions tagged [mongo-go]

Official MongoDB Go driver

Official driver page: https://docs.mongodb.com/ecosystem/drivers/go/

It is available here: https://github.com/mongodb/mongo-go-driver

Documentation (godoc): https://godoc.org/github.com/mongodb/mongo-go-driver

It was announced here: Considering the Community Effects of Introducing an Official MongoDB Go Driver

229 questions
-1
votes
1 answer

Failed to decode camelcase fields using mongo-go-driver

I'm using a struct like so type User struct { Username string `json: "username" bson: "username"` FirstName string `json: "firstName" bson: "firstName"` LastName string `json: "lastName" bson: "lastName"` Email string …
Ubuntu Man
  • 50
  • 1
  • 10
-1
votes
2 answers

How to encode/decode mongodb cursor?

I need to build a list of "pages" so part of this there will be a cursor. The issue is that I can't find a way to encode(to string) and decode the cursor. Any idea? The Cursor interface has no "encoding" method(there is ID, though undocumented) and…
themihai
  • 7,903
  • 11
  • 39
  • 61
-2
votes
1 answer

Which library is More Efficient "gopkg.in/mgo.v2" or "go.mongodb.org/mongo-driver/mongo"

I am using Golang as backed language with mongodb database and also new to this language.I have used both libraries "gopkg.in/mgo.v2" and "go.mongodb.org/mongo-driver/mongo" to perform all CRUD oprations. My Question is which one is more efficient…
Rajandeep Kaur
  • 185
  • 1
  • 9
-2
votes
1 answer

How can I get JSON from BSON without my keys all being named "Key"?

I'm trying to read from a database and then return the result to the user as json. What's happening is that I'm getting output like: [{"Key":"foo","Value":"bar"}] When I would like to get: "{"foo":"bar"}" How do I get the former? Example: (reading…
user773737
1 2 3
15
16