Skip to content

Commit

Permalink
Run ping command in Client.Ping
Browse files Browse the repository at this point in the history
GODRIVER-1068

Change-Id: I1af4c04d7c365be3bde7acc7324332d6c5130fb5
  • Loading branch information
eppingere committed May 30, 2019
1 parent 6745193 commit 9c768d7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mongo/client.go
Original file line number Diff line number Diff line change
@@ -136,8 +136,12 @@ func (c *Client) Ping(ctx context.Context, rp *readpref.ReadPref) error {
rp = c.readPreference
}

_, err := c.topology.SelectServer(ctx, description.ReadPrefSelector(rp))
return replaceErrors(err)
db := c.Database("admin")
res := db.RunCommand(ctx, bson.D{
{"ping", 1},
})

return replaceErrors(res.Err())
}

// StartSession starts a new session.

0 comments on commit 9c768d7

Please sign in to comment.