[GODRIVER-1207] InsertOne returns (NotMaster) not master when connect using "connect=direct" Created: 26/Jul/19  Updated: 11/Sep/19  Resolved: 30/Jul/19

Status: Closed
Project: Go Driver
Component/s: CRUD
Affects Version/s: 1.0.4
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: bimo adi Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

AKS
Kubernetes 1.12
MongoDB 4.0.9



 Description   

I deploy MongoDB replicaset with single endpoint. Want to test connection using simple code to write but write failed by returns '(NotMaster) not master' when i tried to connect to MongoDB using URI "mongodb://serverIP:27017/admin?connect=direct"

```
   rows := db.Database("tester").Collection("test1")
   cursor, err := rows.InsertOne(context.TODO(), json)
   if err != nil

{             log.Printf("%v", err)             continue         }

        id := cursor.InsertedID
```
return message:
```
2019/07/26 13:21:40 (NotMaster) not master
```
But when i create similar function to insert using pymongo, connect using same URI it returns 'no master' for a couple second and then works fine.

```
result = col_ready.insert_one(post).acknowledged
logger("> {1}".format(i, result))
time.sleep(1)
```
return message:
```
2019-07-26 13:25:01,366 not master
2019-07-26 13:25:02,704 > True
```

Did i miss something?
 



 Comments   
Comment by Esha Bhargava [ 30/Jul/19 ]

avbee.lab@gmail.com Thanks for your report. Please note that this project is for reporting bugs or feature suggestions for the driver. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-users group.

 

 

Generated at Thu Feb 08 08:35:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.