pip_services3_mongodb.connect package

Module contents


MongoDbConnectionResolver module initialization.


Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.


MIT, see LICENSE for more details.

class pip_services3_mongodb.connect.MongoDbConnectionResolver

Bases: pip_services3_commons.refer.IReferenceable.IReferenceable, pip_services3_commons.config.IConfigurable.IConfigurable

MongoDbConnectionResolver implementation. Helper class that resolves MongoDB connection and credential parameters, validates them and generates a connection URI.

It is able to process multiple connections to MongoDB cluster nodes.

### Configuration parameters ###
  • connection(s):
    • discovery_key: (optional) a key to retrieve the connection from IDiscovery

    • host: host name or IP address

    • port: port number (default: 27017)

    • database: database name

    • uri: resource URI or connection string with all parameters in it

  • credential(s):
    • store_key: (optional) a key to retrieve the credentials from ICredentialStore

    • username: user name

    • password: user password

### References ###
  • *:discovery:*:*:1.0 (optional) IDiscovery services

  • *:credential-store:*:*:1.0 (optional) ICredentialStore stores to resolve credentials

configure(config: pip_services3_commons.config.ConfigParams.ConfigParams)

Configures component by passing configuration parameters.


config – configuration parameters to be set.

resolve(correlation_id: Optional[str])str

Resolves MongoDB connection URI from connection and credential parameters.


correlation_id – (optional) transaction id to trace execution through call chain.


a resolved URI

set_references(references: pip_services3_commons.refer.IReferences.IReferences)

Sets references to dependent components.


references – references to locate the component dependencies.