@owlmeans/mongo
v0.1.11
Published
MongoDB service for OwlMeans server contexts — connection management with replica set and cluster support.
Readme
@owlmeans/mongo
MongoDB service for OwlMeans server contexts — connection management with replica set and cluster support.
Overview
makeMongoDbService(alias?)— creates a MongoDB connection serviceappendMongo(context, alias?)— registers the service in the context- Reads connection config from
context.cfg.dbs[alias](supportskluster:directives) - Used as the database provider for
@owlmeans/mongo-resource
Installation
bun add @owlmeans/mongoUsage
import { appendMongo, DEFAULT_ALIAS as MONGO_SERVICE } from '@owlmeans/mongo'
// In context setup (backend/src/context.ts)
appendMongo<C, T>(context)Config (config.json):
{
"dbs": {
"mongo": {
"url": "mongodb://localhost:27017",
"dbName": "myapp"
}
}
}API
makeMongoDbService(alias?): MongoDbService
Creates the MongoDB service. alias defaults to DEFAULT_ALIAS ('mongo').
appendMongo<C, T>(context, alias?): T
Registers the MongoDB service in the context.
Constants
DEFAULT_ALIAS—'mongo'DEF_REPLSET—'rs-main'— default replica set name
Related Packages
@owlmeans/mongo-resource—makeMongoResourceuses this service@owlmeans/server-app—makeContextin conjunction withappendMongo@owlmeans/kluster—kluster:directives resolve Mongo URLs in Kubernetes
Agent guidance
This package ships embedded Claude Code skills and GitHub Copilot instructions under
agent-meta/. After installing your @owlmeans/* packages, run the OwlMeans
agent-skills installer to place them into your project's native locations
(.claude/skills/ and .github/instructions/):
npx @owlmeans/agent-skillsThe embedded files are version-matched to this package release. Do not edit them directly — they are regenerated on each publish. To contribute guidance edits, open a PR against the source monorepo.
