Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex StoreDoc
  • Getting started
    • All guides
      • Pre-configuration
      • Connecting from applications
        • Overview
        • Examples for connection to a non-sharded cluster
        • Examples for connection to a sharded cluster
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  1. Step-by-step guides
  2. Connection
  3. Code snippets
  4. Overview

Code examples for connecting to a Yandex StoreDoc cluster

Written by
Yandex Cloud
Updated at September 25, 2025

Examples were tested in the following environment:

  • Yandex Cloud VM running Ubuntu 20.04 LTS.
  • Bash: 5.0.16.
  • Python: 3.8.2; pip3: 20.0.2.
  • PHP: 7.4.3.
  • OpenJDK: 11.0.8; Maven: 3.6.3.
  • Node.JS: 10.19.0, npm: 6.14.4.
  • Go: 1.13.8.

To see code examples with the host FQDN filled in, open the cluster page in the management console and click Connect.

All examples assume that the root.crt SSL certificate is located in the /home/<home_directory>/.mongodb/ directory.

If the connection to the cluster and the test query are successful, the following data will be output:

  • For PHP examples, the result of the ping command.
  • For other examples, the name of the database the connection was made to.

Available connection methods depend on whether the cluster sharding is enabled:

  • Examples for connection to a non-sharded cluster
  • Examples for connection to a sharded cluster

Was the article helpful?

Previous
Connecting from applications
Next
Examples for connection to a non-sharded cluster
© 2025 Direct Cursus Technology L.L.C.