Skip to main content
1 vote
1 answer
83 views

I’m using MongoDB GoLang Driver v2 and I want to store a custom money type in MongoDB. If the value is nil, I want the BSON document to store price: null. Example document I want: { "name":...
Prakash P's user avatar
  • 4,128
1 vote
0 answers
109 views

I am trying to establish connection with mongoDB using the below code func getSession() \*mgo.Session { // Connect to MongoDB on the default port s, err := mgo.Dial("mongodb://localhost:...
rkmangalp's user avatar
2 votes
1 answer
205 views

I am migrating a go backend from using mgo to mongo-go. The service has lots of code and I have completed most of it except for a part that deals with session.Copy() method from the old mgo. The ...
dezdichado's user avatar
2 votes
0 answers
182 views

Currently, most of my production is based on microservices, and the majority of the services have already been upgraded to the official MongoDB driver. However, with the end-of-life for version 4.X ...
Rawit_S's user avatar
  • 85
1 vote
0 answers
62 views

After linking to mongodb, the Sessionid needs to be converted back to the original format as a string func main() { uri := "mongodb://root:[email protected]:32082,172.22.50.25:32083,172.22.50....
Jun Tao's user avatar
  • 11
3 votes
0 answers
39 views

basically i have this query that searches from an array of names...now i want to make it case insensitive in GO err = c.Find(bson.M{ "name": bson.M{ "$in": ...
Juanchi's user avatar
  • 41
1 vote
0 answers
211 views

I'm connecting a Go application to MongoDB using the following code: session, sessionErr := mgo.Dial("127.0.0.1:27017") The connection is established but doesn't persist as indicated in ...
Foobar's user avatar
  • 933
2 votes
1 answer
2k views

I just followed this tutorial on youtube(https://youtu.be/GwQ1hvuSNJA). But I got an error "no reachable servers" after go run main.go How can I figure it out? Should I change localhost to ...
Shift_that's user avatar
0 votes
1 answer
685 views

I am trying to $match my data after $group but it does not work. I have db with jobs. Every job has {id, batchId(a few jobs can belong to one batch), createdAt, finishedAt}. I cant understand why I am ...
Howkee's user avatar
  • 37
3 votes
1 answer
1k views

I am running the below code. When a user saved in db then blank address is saved I have assigned the null struct to address before save. I can not add the omitempty with all the fields for address ...
Swati's user avatar
  • 49
4 votes
0 answers
2k views

I'm at a bit of an impasse here with a query that SHOULD by all accounts, return results. If I run the following query in mongosh: db.events.aggregate([ {$unwind:"$features&...
Jay's user avatar
  • 85
-2 votes
1 answer
72 views

Likes have different collection, so do Posts. But, maybe it is more efficient and green that: just getting all posts and when users hover on posts fetching likes or when intersection api is triggered ...
Bitdom8's user avatar
  • 1,482
3 votes
2 answers
533 views

I'm using MongoDB driver and mgo-forked qmgo in Go to operate MongoDB (version 5.x). I have some geo-spatial data to store and query, and searched some articles and someone mentioned to create custom ...
Yueyue Wang's user avatar
1 vote
1 answer
1k views

I am trying to connect to a mongo database hosted in azure using the .crt file. I am successfully able to connect from my linux machine terminal using command: mongo mongodb://username:password@prod-...
KIRAN KUMAR B's user avatar
0 votes
1 answer
451 views

I know this has got to be simple, but for the life of me I can't seem to generate the correct final stage in my pipeline to get this working. Here are the documents output from a stage that I have in ...
Jay's user avatar
  • 85

15 30 50 per page
1
2 3 4 5
44