Skip to content

Commit 0c865da

Browse files
authored
DOCS-3749: Store data from viam in MongoDB (#4118)
1 parent fcd9765 commit 0c865da

File tree

2 files changed

+59
-6
lines changed

2 files changed

+59
-6
lines changed

Diff for: docs/data-ai/capture-data/advanced/advanced-data-capture-sync.md

+58-5
Original file line numberDiff line numberDiff line change
@@ -579,24 +579,27 @@ The following sample configuration captures data from a sensor at 0.5 Hz.
579579

580580
{{% /expand%}}
581581

582-
### Capture directly to local MongoDB
582+
### Capture directly to your own MongoDB cluster
583583

584584
You can configure direct capture of tabular data to a MongoDB instance alongside disk storage on your edge device.
585585
This can be useful for powering real-time dashboards before data is synced from the edge to the cloud.
586+
The MongoDB instance can be a locally running instance or a cluster in the cloud.
586587

587588
Configure using the `mongo_capture_config` attributes in your data manager service.
589+
You can configure data sync to a MongoDB instance separately from data sync to the Viam Cloud.
588590

589-
Here is a sample configuration that will capture fake sensor readings both to the configured MongoDB URI as well as to the `~/.viam/capture` directory on disk:
591+
{{< expand "Click to view sample configuration with MongoDB data store." >}}
590592

591-
{{< expand "Click to view configuration" >}}
593+
This sample configuration captures fake sensor readings both to the configured MongoDB URI as well as to the `~/.viam/capture` directory on disk.
594+
It does not sync the data to the Viam Cloud.
592595

593596
```json
594597
{
595598
"components": [
596599
{
597600
"name": "sensor-1",
598601
"api": "rdk:component:sensor",
599-
"model": "fake",
602+
"model": "rdk:builtin:fake",
600603
"attributes": {},
601604
"service_configs": [
602605
{
@@ -618,7 +621,6 @@ Here is a sample configuration that will capture fake sensor readings both to th
618621
{
619622
"name": "data_manager-1",
620623
"api": "rdk:service:data_manager",
621-
"model": "rdk:builtin:builtin",
622624
"attributes": {
623625
"mongo_capture_config": {
624626
"uri": "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000"
@@ -631,6 +633,57 @@ Here is a sample configuration that will capture fake sensor readings both to th
631633

632634
{{< /expand >}}
633635

636+
{{< expand "Click to view sample configuration with MongoDB data store and sync to the Viam Cloud." >}}
637+
638+
This sample configuration captures fake sensor readings both to the configured MongoDB URI as well as to the `~/.viam/capture` directory on disk.
639+
It syncs data to the Viam Cloud every 0.1 minutes.
640+
641+
```json
642+
{
643+
"components": [
644+
{
645+
"name": "sensor-1",
646+
"api": "rdk:component:sensor",
647+
"model": "rdk:builtin:fake",
648+
"attributes": {},
649+
"service_configs": [
650+
{
651+
"type": "data_manager",
652+
"attributes": {
653+
"capture_methods": [
654+
{
655+
"method": "Readings",
656+
"capture_frequency_hz": 0.5,
657+
"additional_params": {}
658+
}
659+
]
660+
}
661+
}
662+
]
663+
}
664+
],
665+
"services": [
666+
{
667+
"name": "data_manager-1",
668+
"api": "rdk:service:data_manager",
669+
"attributes": {
670+
"mongo_capture_config": {
671+
"uri": "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000"
672+
},
673+
"additional_sync_paths": [],
674+
"sync_interval_mins": 0.1,
675+
"capture_dir": "",
676+
"capture_disabled": false,
677+
"sync_disabled": false,
678+
"tags": []
679+
}
680+
}
681+
]
682+
}
683+
```
684+
685+
{{< /expand >}}
686+
634687
When `mongo_capture_config.uri` is configured, data capture will attempt to connect to the configured MongoDB server and write captured tabular data to the configured `mongo_capture_config.database` and `mongo_capture_config.collection` (or their defaults if unconfigured) after enqueuing that data to be written to disk.
635688

636689
If writes to MongoDB fail for any reason, data capture will log an error for each failed write and continue capturing.

Diff for: docs/data-ai/capture-data/advanced/how-sync-works.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ If your robot is offline and can't sync and your machine's disk fills up beyond
115115
For more information, see [Automatic data deletion details](/data-ai/capture-data/advanced/how-sync-works/)
116116

117117
Data capture supports capturing tabular data directly to MongoDB in addition to capturing to disk.
118-
For more information, see [Capture directly to MongoDB](/data-ai/capture-data/advanced/advanced-data-capture-sync/#capture-directly-to-local-mongodb).
118+
For more information, see [Capture directly to MongoDB](/data-ai/capture-data/advanced/advanced-data-capture-sync/#capture-directly-to-your-own-mongodb-cluster).

0 commit comments

Comments
 (0)