Openframe Data Mongo Common
OpenFrame Documentation
Get the most out of OpenFrame · Book 30 minutes with Conrad, 25 years in IT. He'll show you what Mingo and Fae can take off your list.
OpenFrame Documentation
Openframe Data Mongo Common is the shared MongoDB domain-model and repository-support artifact used by OpenFrame services. It is supplied by the OpenFrame OSS Library as Maven artifact com.openframe.oss:openframe-data-mongo-common at version 7.0.11; this tenant repository consumes it rather than defining its source. The module establishes portable document fragments, stable workflow enums, a tenant identifier fallback, and custom package-catalog persistence behavior that other Mongo modules assemble into service-specific repositories.
The source is maintained in the OpenFrame OSS Library. This document links to the verified source revision used by the artifact.
Device Mongo document and its embedded configuration, health, alert, and security structures.TenantIdProvider that resolves TENANT_ID, falling back to oss when no application-specific provider exists.flowchart TD
Services["OpenFrame Services"] --> Common["Openframe Data Mongo Common"]
Common --> Models["Shared Documents and Enums"]
Common --> Catalog["Package Catalog Repository Support"]
Common --> Tenant["Default Tenant Provider"]
Models --> Mongo["MongoDB Documents"]
Catalog --> MongoTemplate["Spring MongoTemplate"]
MongoTemplate --> Mongo["MongoDB Collections"]
Tenant --> TenantScoped["Tenant-Scoped Documents"]
The module intentionally separates reusable data vocabulary from operational persistence configuration. The neighboring Openframe Data Mongo Sync module contributes synchronous Mongo configuration and concrete domain repositories, while Openframe Data Mongo Reactive provides reactive repositories. This module is their shared model-level dependency.
The central document is Device. It is stored in the devices collection, has a Mongo identifier, and implements the library's tenant-scoping contract. tenantId is indexed, enabling tenant-oriented retrieval. The document records a link to a machine, hardware and operating-system details, operational status and type, a last-check-in timestamp, plus embedded configuration and health snapshots.
flowchart LR
Device["Device Document"] --> Identity["ID, Tenant ID, Machine ID"]
Device --> Inventory["Serial, Model, OS, Type, Status"]
Device --> Checkin["Last Check-In"]
Device --> Configuration["Device Configuration"]
Device --> Health["Device Health"]
Configuration --> SecuritySettings["Security Settings"]
Health --> Alerts["Alerts"]
| Type | Role |
|---|---|
DeviceConfiguration |
Captures generic settings, installed software, network configuration, and nested security settings. |
DeviceHealth |
Holds CPU, memory, and disk usage, active processes, and operational alerts. |
Alert |
Represents an operational alert with severity, message, timestamp, and resolution flag. |
SecuritySettings |
Records firewall and antivirus state, encryption status, a security-scan value, and policy settings. |
SecurityAlert |
Represents a security finding with detection and optional resolution timestamps and resolution detail. |
ComplianceRequirement |
Tracks the standard, control, result, details, and most recent check for one compliance requirement. |
RequiredTools |
Defines Fleet MDM and MeshCentral as the tool connections required before a device counts as managed. |
ComplianceState supports COMPLIANT, NON_COMPLIANT, IN_REMEDIATION, and UNKNOWN. SecurityState uses COMPLIANT, NON_COMPLIANT, and UNKNOWN. These enums prevent ad hoc status values at persistence boundaries.
The following types are shared persisted values and should be extended cautiously because consumers may rely on their exact serialized names.
| Area | Types and values |
|---|---|
| Client installation | InstallationType: STANDARD, GUI_APP, SERVICE. |
| Connector failures | ConnectorAlertType: retry exhaustion or a non-recoverable error. |
| Tenant onboarding | TenantOnboardingStep: MSP setup, customer setup, device management, and meeting Mingo. |
| User onboarding | UserOnboardingStep: Mingo, devices, tickets, scripting, monitoring, logging, incidents, and knowledge management. |
| Ticket activity | TicketActivityState: AI working, awaiting an external actor, or idle. |
| Tool agent lifecycle | IntegratedToolInstallationTaskStatus: processing, processed, or failed. |
| Tool-agent context | SessionType identifies service, console, or user execution. ToolAgentAssetSource identifies Tool API or GitHub assets. |
LocalFilenameConfiguration pairs a local asset filename with an operating-system value for platform-specific installation selection.
Organization address and contact data are deliberately embedded. Address provides street, locality, region, postal code, and country fields. ContactPerson stores name, title, phone, and email. ContactInformation combines a contact list with physical and mailing addresses; its contact list defaults to empty and its mailing-address flag defaults to false.
NotificationRetention defines HISTORY_TTL_SECONDS as 2_592_000, or 30 days. Notification collections use this value as the expireAfterSeconds setting for a Mongo TTL index on createdAt, so history and read-state records expire automatically.
PackageCatalogRepositoryCustom defines two operations: bulk replacement upsert of catalog entries and name search constrained to a package manager. PackageCatalogRepositoryImpl implements those operations through MongoTemplate.
flowchart TD
Writer["Catalog Synchronizer"] --> Upsert["upsertAll Entries"]
Upsert --> Bulk["Unordered Bulk Replace with Upsert"]
Bulk --> CatalogCollection["Package Catalog Collection"]
Query["Search Request"] --> MatchManager["Match Package Manager"]
MatchManager --> Score["Score Exact, Prefix, or Contains"]
Score --> Rank["Rank by Score and Requested Order"]
Rank --> Cursor["Apply Cursor and Limit Plus One"]
Cursor --> Page["Hits, Total, Has More, Cursor"]
upsertAll builds an unordered bulk operation. Each entry is replaced by its Mongo _id, with upsert enabled. This supports efficient catalog refreshes while retaining entries not present in a particular batch unless the caller removes them separately.
searchByName first filters by package manager, then computes a case-insensitive score from the package name:
| Match | Score |
|---|---|
| Exact name | 3 |
| Name prefix | 2 |
| Name contains the query after the first character | 1 |
| No match | 0 |
Only positive scores are returned. Searches use an English case-insensitive Mongo collation and lower-case comparison for the substring calculation. Results are ordered by score first, then either popularity descending or name ascending, followed by package identifier ascending as a deterministic tie-breaker.
The result cursor encodes score, package identifier, and the active secondary key. The aggregation retains the total count of all matches, while applying the cursor only to the hit branch. Fetching one item beyond the requested limit determines whether a subsequent page exists. Invalid or malformed cursors are logged and treated as a request for the first page rather than failing the query.
DefaultTenantIdProvider is a Spring service enabled only when no other TenantIdProvider bean is supplied. It returns the TENANT_ID property and defaults to oss. Applications that establish tenant context dynamically should provide their own TenantIdProvider; the conditional default then remains inactive.
This module does not expose HTTP endpoints and does not configure a Mongo connection. Those concerns belong to service and Mongo integration modules that depend on it.
Device collection name and tenantId index unless a data migration and query review accompany the change.