[GODRIVER-1097] mongo.NewClient may have some problem Created: 30/May/19  Updated: 27/Oct/23  Resolved: 27/Jun/19

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

Type: Bug Priority: Major - P3
Reporter: lu qian Assignee: Divjot Arora (Inactive)
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

win 10


Attachments: File main.go    

 Comments   
Comment by Divjot Arora (Inactive) [ 05/Jun/19 ]

qianlu5110@126.com Can you confirm that this works if you use options.Client.ApplyURI("mongodb://192.168.96.240:27017") instead? Also, can you give any additional information about the error you're getting when trying to use SetHosts?

Comment by lu qian [ 30/May/19 ]

clientOptions := options.Client()
clientOptions.Hosts = []string{"192.168.96.240:27017"}
clientOptions.Auth = nil

// if i use this method,i can't get a effective client
client, err := mongo.NewClient(clientOptions)
if err != nil

{ fmt.Println(err) }

 

// I don't want use default way to parse client options. It's just a simple question.

// Thanks

 

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