We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e69196 commit 71468baCopy full SHA for 71468ba
source/includes/connection-snippets/x509-snippets/ruby-connection.rb
@@ -0,0 +1,11 @@
1
+# begin x509 connection
2
+require 'mongo'
3
+certificate_key_file_path = '/etc/certs/mongodb/client.pem'
4
+uri = 'mongodb+srv://<cluster-url>/test?authSource=$external&tlsCertificateKeyFile=' + certificate_key_file_path + '&retryWrites=true&w=majority&authMechanism=MONGODB-X509'
5
+
6
+client = Mongo::Client.new([ uri ], :database => 'testDB')
7
8
+collection = client[:testCol]
9
+doc_count = collection.count_documents({})
10
+print doc_count
11
+# end x509 connection
0 commit comments