ulo
ulo
Documentation

Start here

Coming from NestJSNestJS topics, mapped

The model

Protocols

Integrations

DatabaseConnectingMigrationsSeveral instancesSQLxSeaORMDieselMongoDBRedis

Operating

Reference

Database

MongoDB

The MongoDB client as a store, and how the URI scheme decides whether the module can start lazily.

ulo-db-mongodb binds mongodb::Client. MongoDB has no migrator, so the module has no .migrate(..).

crates/ulo-db-mongodb/src/lib.rs
use ulo_db_mongodb::MongoModule;

m.import(MongoModule::from_config(&config, "mongo"));

Options

KeyMeaning
urimongodb:// or mongodb+srv://. A Secret. The key is uri, not url.
max_pool_sizeOptional.
min_pool_sizeOptional.
app_nameOptional.

The scheme decides the start

Whether creating the client connects depends on the URI. Client::with_options connects nothing, but parsing a mongodb+srv URI resolves its DNS inside create.

URIcreateStart.lazy()
mongodb://Resolves nothing.The ping retries under connect_within.Offered.
mongodb+srv://Resolves DNS, retried by ulo-db's loop under connect_within.One confirming ping after the loop.Refused at wire(), naming the scheme.

wire() checks the scheme and a host and does no lookup, since validation must not touch the network.

MongoDB has no unknown-database error, because it creates a database on first write. A database named in the URL with no authSource becomes the authentication source and fails as an authentication error, which is permanent.

Authentication cost

The driver derives a SCRAM key on the thread that polls the connect, and the store leaves it there. Against a server with a root user and --auth, the longest gap between two ticks of a 5 ms ticker on a one-thread runtime was a median of 7.1 ms in a release build and 78.0 ms in a debug build. A release build stays far inside a 50 ms bound. An application that runs a one-thread runtime in debug with authentication sees a stall of about 80 ms per connect. The cost is the driver's and not the store's.

No test exercises a TLS connection to MongoDB.

Diesel

diesel-async pools for Postgres, MySQL and SQLite, and how a synchronous driver runs beside an async runtime.

Redis

redis-rs's ConnectionManager as a store, built lazily so the module's ping is the one retry policy.

On this page

OptionsThe scheme decides the startAuthentication cost