DRAFT v10.1.5. Pre-release draft for content review. Do not link from public material. The final page replaces this draft once 10.1.5 ships.
New in 10.1.5. MongoDB is integrated across all four FrameworX data connection surfaces - Dataset Provider, Device Protocol, UNS TagProvider, and Historian StorageLocation. The Dataset Provider also accepts a SQL subset dialect that the connector translates to MongoDB filter, sort, and projection automatically.
MongoDB document databases.
MongoDB is the first document database that FrameworX integrates across all four data connection surfaces. One MongoDB instance can serve any combination of these surfaces from the same solution.
Surface | Configure in | What it does |
|---|---|---|
Dataset Provider | Datasets / DBs / Provider = | Query collections with JSON directives, aggregation pipelines, or the built-in SQL subset dialect. CRUD on collections through Dataset Tables. |
Device Protocol | Devices / Channels / Protocol = | Map individual document fields as Channel, Node, and Point tags. Write updates the latest document in a collection. |
UNS TagProvider (TagDiscovery) | UNS / TagProviders / Protocol = | Browse collections as a tag tree. Register document fields as UNS tags. Updates write back with |
Historian StorageLocation | Historian / Storage Locations / Protocol = | Store historian tag samples in MongoDB Time Series Collections. Append-style writes. |
A MongoDB UnsTagProvider row and a Historian StorageLocation row can both point at the same MongoDB instance.
MongoDB .NET drivers ship unconditionally with FrameworX in FS/ThirdPartyBin/. No separate install and no optional pack. Approximate footprint is 4 MB per framework (net48 and net10).
Use MongoDB with the Datasets module to read and write document data from a FrameworX solution. The provider exposes four query shapes through the standard Dataset Query object and binds full document collections through Dataset Table for CRUD work.
Steps to connect:
Install a MongoDB server (6.0 or newer, 7.0 LTS recommended), create a database and user, then move to the FrameworX configuration below.
Follow the official MongoDB installation guide for your platform at mongodb.com/docs/manual/installation. Summary by target:
mongod as a Windows service on port 27017.apt install mongodb-org on Debian or Ubuntu with the MongoDB repository configured). Start the service with systemctl start mongod.brew tap mongodb/brew && brew install mongodb-community, then brew services start mongodb-community.docker run -d --name fx-mongo -p 27017:27017 mongo:7.Install the mongosh command-line shell alongside the server. Most platform installers include it by default.
Run the command below to confirm the server responds:
mongosh "mongodb://localhost:27017" --quiet --eval "db.adminCommand('ping').ok"
A successful ping returns 1.
Run these commands in mongosh to create a target database, a starter collection, and a user for FrameworX to authenticate as:
use plant_data
db.readings.insertOne({ plant: "Plant01", value: 0, ts: new Date() })
db.createUser({
user: "fxuser",
pwd: "<choose-a-strong-password>",
roles: [ { role: "readWrite", db: "plant_data" } ]
})
The user is stored against the plant_data database above. Use plant_data as the Auth Source value in the FrameworX connection string in the next section, or use admin when the user lives in the admin database.
The MongoDB connector targets netstandard2.0 and runs unchanged on both .NET Framework 4.8 (Designer and Windows Runtime) and .NET 10 (cross-platform Runtime on Windows, Linux, and containers). The vendored MongoDB driver ships in both flavors with the FrameworX installation. The mongod server is OS-native and has no .NET dependency.
Follow the steps below to connect FrameworX to a MongoDB server.
mongodb:// or mongodb+srv:// URI, which overrides the structured fields.
Field | Required | Description | Example |
|---|---|---|---|
Server | Yes | Host name or IP of the MongoDB server. | localhost |
Port | No | TCP port. Default is 27017. | 27017 |
User | No | Database user. Leave empty for unauthenticated access. | appuser |
Password | No | User password. Stored encrypted in the solution file. | ******** |
Database | Yes | Target database name. | plant_data |
Auth Source | No | SCRAM authentication database. Default is | admin |
TLS | No | Set to true for TLS/SSL connections. | true |
Connection URI | No | Full MongoDB URI. Overrides the structured fields. Use for replica sets and | mongodb+srv://user:pwd@cluster0.example.net/?retryWrites=true |
MongoDB queries accept four input shapes. The provider routes the Command Text of a Dataset Query to the correct driver operation based on the input shape:
Input shape | Operation | Description |
|---|---|---|
Plain collection name, no braces or brackets | Find | Returns all documents in the collection, with columns auto-detected from the first document. |
JSON object starting with | Find or Count | Reads |
JSON array starting with | Aggregate | Treated as an aggregation pipeline. Requires a default collection set on the Dataset Query. |
SQL statement starting with | SQL subset (new in 10.1.5) | Parsed by the built-in SQL-to-MongoDB translator. See the next subsection. |
New in Phase B of the 10.1.5 MongoDB connector, users can write standard SELECT statements in the Dataset Query SqlStatement. The connector translates the statement to a MongoDB filter, sort, and projection automatically and executes it through the same driver that handles JSON directives and aggregation pipelines.
The translator accepts this subset of standard SQL:
SELECT cols | *, FROM collection, WHERE expr, ORDER BY col [ASC|DESC] (, col [ASC|DESC]...), LIMIT n.=, <>, !=, <, <=, >, >=.AND, OR, NOT.IS [NOT] NULL, [NOT] BETWEEN ... AND ..., [NOT] IN (...), [NOT] LIKE.plant), double-quoted ("plant"), bracketed ([plant]), back-ticked (`plant`).site.line.station resolve to nested BSON fields.-42 or -3.14.x IS NULL and x = NULL both match documents where the field is missing or has a null value. This follows the MongoDB idiom for missing-or-null match.LIKE translates to an anchored regular expression. The wildcard % becomes .* and _ becomes .. Case-folding collation is not applied.@Tag.Name references before the statement reaches the SQL-to-MongoDB bridge, so tag values appear as literals in the parsed statement.All three shapes below coexist at the same Provider = MongoDB.Driver. Pick the shape that fits the call site.
JSON directive.
{ "collection": "readings", "filter": { "plant": "Plant01" }, "sort": { "ts": -1 }, "limit": 10 }
Aggregation pipeline.
[
{ "$match": { "plant": "Plant01" } },
{ "$sort": { "ts": -1 } },
{ "$limit": 10 }
]
SQL subset.
SELECT plant, value, ts FROM readings WHERE plant = 'Plant01' ORDER BY ts DESC LIMIT 10
The translator raises MongoSqlTranslationException for any construct outside the supported grammar. Out-of-scope constructs include:
GROUP BY and aggregate functions (COUNT, SUM, AVG, MIN, MAX).JOIN in any form.DISTINCT.OFFSET.SELECT or WHERE.INSERT, UPDATE, DELETE statements (use Dataset Tables, or write an aggregation pipeline).These constructs are parked for later releases. No ETA is promised. Use an aggregation pipeline or a Dataset Table when the SQL subset does not cover the need.
UpdateOne with $set on tracked columns. Fields outside the tracked column list are preserved on update.BulkWrite with the same tracking rules.mongodb+srv:// URIs.For an end-to-end Dataset configuration that reads, aggregates, and writes documents in a MongoDB collection (one Dataset DB, three Queries, one Dataset Table, three Script Tasks), see the dedicated example page: Datasets MongoDB Example.
The example uses the seed data described in the Installation section above (database plant_data, collection readings).
Use the Device Protocol surface when you want each MongoDB document field addressed as an individual Tag with a Node-level connection. This is the classic SCADA Channel / Node / Point model.
Use UNS TagProvider instead (next section) when you want dynamic browse and tree-style registration.
Channel. Devices / Channels / New. Protocol = MongoDB. Interface is automatically Custom (no CommAPI).
Node. One Node per MongoDB server plus database. PrimaryStation is a delimited string with the shape:
ConnectionUri;Database;AuthSource;TlsEnabled
Example value:
mongodb://localhost:27017;plant_a;admin;false
Point. Address is a single-dot collection.field string. Example: sensors.temperature.
On each scan cycle, the driver runs one find per configured address, sorts by _id descending, limits to 1, and projects the requested field. The value is returned as a string on every successful read. Quality is 192 (Good) on hit, 0 (Bad) when the collection is empty or the field is absent.
Values round-trip as strings in the Device path. Numeric or boolean tags show their value as text. Use the UNS TagProvider surface (next section) when your integration needs the value native type preserved.
WriteTagValue finds the most recent document in the collection and runs $set on that document _id. If the collection is empty, a fresh document is inserted with the field plus a ts UTC timestamp.
This is config-style or settings-style write behavior. Every write mutates the latest document. It does NOT append a new time-series sample. Use a Historian StorageLocation (later section) for append-style time-series writes.
Only single-dot addresses are accepted in 10.1.5. collection.field works. collection.field.subfield is rejected. Nested BSON path support is planned for a later release.
This example maps a single MongoDB document field to a Tag using the Channel / Node / Point model. Prerequisites: a running mongod with the plant_data database and the sensors collection from the Installation section above, plus a UNS Tag named SensorTemp of type Double.
MongoDB. The Interface is set to Custom automatically.mongodb://localhost:27017;plant_data;admin;false
sensors.temperature.temperature value from the most recent document in the sensors collection on each scan cycle.@Tag.SensorTemp = 75.0;. The driver runs $set on the latest sensors document. The collection's most recent document is mutated in place. This is config-style write behavior, not append. Use the Historian StorageLocation surface (later section) for append-style time-series writes.Use the UNS TagProvider surface when you want to browse a MongoDB instance from the Designer UNS tree, discover field names dynamically, and register fields as UNS tags.
UNS / TagProviders / New. Protocol = MongoDB. Station uses the same delimited format as the Device Protocol:
ConnectionUri;Database;AuthSource;TlsEnabled
The browse view has two levels:
sort({_id:-1}).limit(1) and lists that document top-level field names. The _id field is hidden from the browse view.The browse is schema-less. If different documents in a collection carry different fields, the browse reflects only the sample document. Register the fields you need and define them explicitly on the UNS Tag when the schema varies.
Designer refresh does not mutate state. Browse is side-effect-free and safe to call on every tree expansion.
Select a field under a collection and use Add to UNS. The registered address is collection.field. The attribute type is string in 10.1.5 (all scalars). Typed registration is planned for a later release.
Identical to the Device Protocol section:
$set on the latest document _id, or inserts a minimal document when the collection is empty.Single-dot collection.field only. The registration call rejects multi-dot addresses with the message Multi-segment paths not supported in 10.1.5, use 'collection.field' with a single dot.
This example browses a MongoDB instance from the Designer UNS tree and registers a document field as a UNS tag. Prerequisites: a running mongod with the plant_data database and the sensors collection from the Installation section above.
MongoDB.mongodb://localhost:27017;plant_data;admin;false
plant_data at level 0 (for example readings and sensors).temperature, plant, ts). The _id field is hidden.temperature field and choose Add to UNS. A tag MongoTags/sensors/temperature appears in the UNS Tags list with attribute type string.@Tag.MongoTags/sensors/temperature reads the latest temperature value from the collection on each scan cycle.$set on the latest sensors document, with the same UPDATE semantics as the Device Protocol surface.Use this surface when you want FrameworX Historian to write tag samples into MongoDB as an append-style time series. This is the append behavior most users expect from a historian.
A MongoDB UNS TagProvider row must already exist (previous section). The Historian StorageLocation references it by name.
Historian / Storage Locations / New. The Protocol combo includes MongoDB when the TagProvider row has IsHistorian="true" (the default for 10.1.5). The DataRepository field selects which MongoDB UnsTagProvider to use.
Each FrameworX tag-collection maps to a MongoDB Time Series Collection (MongoDB 6.0+). The canonical document schema is:
{
"t": "<UTC DateTime>",
"m": { "tag": "<address>" },
"v": "<value>",
"q": "<quality ushort>"
}
The collection is created on first write if absent. Granularity is hard-coded to seconds in 10.1.5. This value is immutable on the MongoDB side after collection creation. Station-configurable granularity is planned for a later release.
WriteHistorianDataEx groups the incoming batch by collection name and calls InsertMany with IsOrdered=false. Every sample becomes a new document. Partial-batch failures are surfaced on a per-document basis. A bad document does not fail the whole batch.
GetSamples does a range query ($gte and $lte on the t field) with ascending sort. The interval and getSamplesMode parameters are ignored in 10.1.5. Raw samples only.
Aggregation (Average, Min, Max, Sum with non-zero interval) is planned for a later release using MongoDB $bucket and $bucketAuto stages.
If a user configures the same collection as BOTH a UNS TagProvider browse target AND a Historian StorageLocation target, the Historian write path succeeds silently into a plain (non-Time-Series) collection but reads behave incorrectly. A runtime guard is planned for a later release. Until it lands, use distinct collection names for the two roles.
This example appends historian samples for a UNS tag to a MongoDB Time Series Collection. Prerequisites: a UNS TagProvider MongoTags exists from the previous section and points at the same MongoDB instance, plus a UNS Tag SensorTemp of type Double being updated by a Device, Script, or external source.
TagProvider.MongoTags.plant_data with the canonical schema documented in the Storage model section above (granularity hard-coded to seconds in 10.1.5). Subsequent samples are appended via InsertMany with IsOrdered=false.@Tag.SensorTemp.GetSamples(...) from a Script or Trend control. The connector runs a range query on the t field with ascending sort and returns raw samples. Aggregation (Average, Min, Max, Sum with non-zero interval) is planned for a later release.The table below collects per-surface limits that apply to the 10.1.5 release.
Area | Limit | Workaround |
|---|---|---|
Dataset SQL subset |
| Use an aggregation pipeline or a Dataset Table for the operation. |
Dataset SQL subset - collation | No collation is applied. Comparisons follow BSON default collation and identifiers are case-sensitive. | Normalize case on ingest, or use the aggregation pipeline with an explicit |
Device and UNS address format | Single-dot | Flatten nested documents on ingest, or wait for a later release. |
Device and UNS values | Round-trip as strings. | Use typed tag bindings on the UNS side for numerical dashboards. |
Historian granularity | Hard-coded to | Choose the most precise granularity at collection creation. Recreate the collection to change. |
Historian aggregation | Raw samples only. Average, Min, Max, Sum with an interval are not supported. | Request raw samples and aggregate in FX Trend or Script. |
Historian connection pool | One | Scope time ranges tightly on dashboards. |
UNS and Historian on the same collection | No runtime guard against mixing. | Use distinct collection names for the two roles. |