Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
67d79f7
Initial commit on INTPYTHON-297-MongoDB-Feast-Integration
caseyclements Jan 20, 2026
4d0f066
Added mongodb to project.optional-dependencies in pyproject.toml. Now…
caseyclements Jan 20, 2026
18b16b9
Checkpoint. Passing tests.unit.online_store.test_online_writes.TestOn…
caseyclements Feb 12, 2026
a066a99
Handle Nan in dfs for test_online_writes.py. Now all tests in the mod…
caseyclements Feb 13, 2026
7c17759
Removed suffix of implementation: mongodb_openai -> mongodb
caseyclements Feb 13, 2026
c463f4a
Moved MongoDBOnlineStore to feast.infra.online_store.contrib
caseyclements Feb 19, 2026
a6db5c7
Formatting
caseyclements Feb 19, 2026
9ed89f0
Refactor online_read that converts bson to proto. Left two methods fo…
caseyclements Feb 19, 2026
40e5ea5
Remove file added early during discovery
caseyclements Feb 19, 2026
67f2c99
Formatting
caseyclements Feb 19, 2026
35b66f0
Added version of test that uses testcontainers mongodb instead of ass…
caseyclements Feb 20, 2026
a526a0c
Create Make target for universal tests
caseyclements Feb 20, 2026
b0d57f5
Cleanup
caseyclements Feb 20, 2026
5a94a11
Removed temporary integration tests requiring one to spin up own mong…
caseyclements Feb 20, 2026
46898b5
Format
caseyclements Feb 20, 2026
0356261
Typing
caseyclements Feb 20, 2026
960881d
Implemented ASync API and Tests
caseyclements Feb 21, 2026
52948a2
Removed offline store stubs. The first PR will only contain the Onlin…
caseyclements Feb 23, 2026
f2e5dff
Moved mongodb_online_store out of cobtrib package.
caseyclements Feb 23, 2026
7f5a192
Add documentation.
caseyclements Feb 24, 2026
619fdd3
Cleanups and docstrings
caseyclements Feb 24, 2026
1f46d8e
Fixed another reference to contrib dir
caseyclements Feb 24, 2026
de6b103
Typos
caseyclements Feb 25, 2026
7e2a80d
Made _convert_raw_docs_to_proto staticmethods private
caseyclements Feb 25, 2026
8a82e74
After benchmarking two alogithm for conevrting read results from bson…
caseyclements Feb 25, 2026
f09faa0
Add extra unit tests
caseyclements Feb 25, 2026
0ba503c
Formatting
caseyclements Feb 25, 2026
6b96c0e
Fixes in pyproject.toml
caseyclements Feb 27, 2026
7c3874b
Fixed Detect secrets false positives.
caseyclements Mar 2, 2026
49022e3
Update sdk/python/feast/infra/online_stores/mongodb_online_store/mong…
caseyclements Mar 2, 2026
a2c493e
Fix CI: guard pymongo imports and skip test module when pymongo unava…
caseyclements Mar 3, 2026
dcb9072
Fix: return (None, None) when entity doc exists but feature view was …
caseyclements Mar 3, 2026
bcb63aa
Update pixi.lock after adding mongodb optional dependency to pyprojec…
caseyclements Mar 3, 2026
1cb84dc
fix: catch FeastExtrasDependencyImportError in doctest runner
caseyclements Mar 4, 2026
c02eebf
fix: update PYTEST_PLUGINS path for mongodb online store tests
caseyclements Mar 4, 2026
3eb6107
fix: broaden import exception handling in doctest runner to catch Typ…
caseyclements Mar 4, 2026
01d2e4c
fix: pass onerror to pkgutil.walk_packages to suppress non-ImportErro…
caseyclements Mar 4, 2026
156f17b
fix: update stale tests.integration.feature_repos imports to tests.un…
caseyclements Mar 4, 2026
762d17b
feat: add mongodb to ValidOnlineStoreDBStorePersistenceTypes in feast…
caseyclements Mar 5, 2026
6147c87
feat: add Feast driver metadata to MongoDB client instantiations
caseyclements Mar 5, 2026
1492a1e
docs: update MongoDB online store status from alpha to preview
caseyclements Mar 5, 2026
0d80772
fix: add mongodb to kubebuilder Enum annotations for OnlineStoreDBSto…
caseyclements Mar 5, 2026
7563f11
Update +GOLANGCI_LINT_VERSION to fix upstream issue golang/go#74462
caseyclements Mar 6, 2026
26ad3bb
fix: raise ValueError in _get_client_async for invalid config type, c…
caseyclements Mar 6, 2026
2f92af9
fix: Added mongodb to operator yamls
ntkathole Mar 9, 2026
577f2a7
Small change suggested by ntkathole
caseyclements Mar 9, 2026
e761e10
Factor out write logic into utility function making sync/async essent…
caseyclements Mar 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add documentation.
Signed-off-by: Casey Clements <casey.clements@mongodb.com>
  • Loading branch information
caseyclements committed Mar 10, 2026
commit 7f5a192a8ce60f7a677c738829fad75953b51ed6
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
* [ScyllaDB](reference/online-stores/scylladb.md)
* [SingleStore](reference/online-stores/singlestore.md)
* [Milvus](reference/online-stores/milvus.md)
* [MongoDB](reference/online-stores/mongodb.md)
* [Registries](reference/registries/README.md)
* [Local](reference/registries/local.md)
* [S3](reference/registries/s3.md)
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/online-stores/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Please see [Online Store](../../getting-started/components/online-store.md) for
[mysql.md](mysql.md)
{% endcontent-ref %}

{% content-ref url="mongodb.md" %}
[mongodb.md](mongodb.md)
{% endcontent-ref %}

{% content-ref url="hazelcast.md" %}
[hazelcast.md](hazelcast.md)
{% endcontent-ref %}
Expand Down
181 changes: 181 additions & 0 deletions docs/reference/online-stores/mongodb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# MongoDB online store (Alpha)

## Description

The [MongoDB](https://www.mongodb.com/) online store provides support for materializing feature values into MongoDB for serving online features.

{% hint style="warning" %}
The MongoDB online store is currently in **alpha development**. Some functionality may be unstable, and breaking changes may occur in future releases.
{% endhint %}

## Features

* Supports both synchronous and asynchronous operations for high-performance feature retrieval
* Native async support uses PyMongo's `AsyncMongoClient` (no Motor dependency required)
* Flexible connection options supporting MongoDB Atlas, self-hosted MongoDB, and MongoDB replica sets
* Automatic index creation for optimized query performance
* Entity key collocation for efficient feature retrieval

## Getting started

In order to use this online store, you'll need to install the MongoDB extra (along with the dependency needed for the offline store of choice):

```bash
pip install 'feast[mongodb]'
```

You can get started by using any of the other templates (e.g. `feast init -t gcp` or `feast init -t snowflake` or `feast init -t aws`), and then swapping in MongoDB as the online store as seen below in the examples.

## Examples

### Basic configuration with MongoDB Atlas

{% code title="feature_store.yaml" %}
```yaml
project: my_feature_repo
registry: data/registry.db
provider: local
online_store:
type: mongodb
connection_string: "mongodb+srv://username:password@cluster.mongodb.net/"
database_name: feast_online_store
```
{% endcode %}

### Self-hosted MongoDB with authentication

{% code title="feature_store.yaml" %}
```yaml
project: my_feature_repo
registry: data/registry.db
provider: local
online_store:
type: mongodb
connection_string: "mongodb://username:password@localhost:27017/"
database_name: feast_online_store
collection_suffix: features
```
{% endcode %}

### MongoDB replica set configuration

{% code title="feature_store.yaml" %}
```yaml
project: my_feature_repo
registry: data/registry.db
provider: local
online_store:
type: mongodb
connection_string: "mongodb://host1:27017,host2:27017,host3:27017/?replicaSet=myReplicaSet"
database_name: feast_online_store
client_kwargs:
retryWrites: true
w: majority
```
{% endcode %}

### Advanced configuration with custom client options

{% code title="feature_store.yaml" %}
```yaml
project: my_feature_repo
registry: data/registry.db
provider: local
online_store:
type: mongodb
connection_string: "mongodb+srv://cluster.mongodb.net/"
database_name: feast_online_store
collection_suffix: features
client_kwargs:
maxPoolSize: 50
minPoolSize: 10
serverSelectionTimeoutMS: 5000
connectTimeoutMS: 10000
```
{% endcode %}

The full set of configuration options is available in [MongoDBOnlineStoreConfig](https://rtd.feast.dev/en/latest/#feast.infra.online_stores.contrib.mongodb_online_store.mongodb.MongoDBOnlineStoreConfig).

## Data Model

The MongoDB online store uses a **single collection per project** with entity key collocation. Features from multiple feature views for the same entity are stored together in a single document.

### Example Document Schema

The example shows a single entity. It contains 3 features from 2 feature views: "rating" and "trips_last7d" from Feature
View "driver_stats", and "surge_multiplier" from "pricing" view.
Each feature view has its own event timestamp.
The "created_timestamp" marks when the entity was materialized.

```javascript
{
"_id": "<serialized_entity_key>", // Binary entity key (bytes)
"features": {
"driver_stats": {
"rating": 4.91,
"trips_last_7d": 132
},
"pricing": {
"surge_multiplier": 1.2
}
},
"event_timestamps": {
"driver_stats": ISODate("2026-01-20T12:00:00Z"),
"pricing": ISODate("2026-01-21T08:30:00Z")
},
"created_timestamp": ISODate("2026-01-21T12:00:05Z")
}
```

### Key Design Decisions

* **`_id` field**: Uses the serialized entity key (bytes) as the primary key for efficient lookups
* **Nested features**: Features are organized by feature view name, allowing multiple feature views per entity
* **Event timestamps**: Stored per feature view to track when each feature set was last updated
* **Created timestamp**: Global timestamp for the entire document

### Indexes

The online store automatically creates the following index:
* Primary key index on `_id` (automatic in MongoDB), set to the serialized entity key.

No additional indexes are required for the online store operations.

## Async Support

The MongoDB online store provides native async support using PyMongo 4.13+'s stable `AsyncMongoClient`. This enables:

* **High concurrency**: Handle thousands of concurrent feature requests without thread pool limitations
* **True async I/O**: Non-blocking operations for better performance in async applications
* **10-20x performance improvement**: For concurrent workloads compared to sequential sync operations

Both sync and async methods are fully supported:
* `online_read` / `online_read_async`
* `online_write_batch` / `online_write_batch_async`

## Functionality Matrix

The set of functionality supported by online stores is described in detail [here](overview.md#functionality).
Below is a matrix indicating which functionality is supported by the MongoDB online store.

| | MongoDB |
| :-------------------------------------------------------- | :------ |
| write feature values to the online store | yes |
| read feature values from the online store | yes |
| update infrastructure (e.g. tables) in the online store | yes |
| teardown infrastructure (e.g. tables) in the online store | yes |
| generate a plan of infrastructure changes | no |
| support for on-demand transforms | yes |
| readable by Python SDK | yes |
| readable by Java | no |
| readable by Go | no |
| support for entityless feature views | yes |
| support for concurrent writing to the same key | yes |
| support for ttl (time to live) at retrieval | no |
| support for deleting expired data | no |
| collocated by feature view | no |
| collocated by feature service | no |
| collocated by entity key | yes |

To compare this set of functionality against other online stores, please see the full [functionality matrix](overview.md#functionality-matrix).

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
feast.infra.online\_stores.mongodb\_online\_store package
=================================================================

Submodules
----------

feast.infra.online\_stores.mongodb\_online\_store.mongodb module
------------------------------------------------------------------------

.. automodule:: feast.infra.online_stores.mongodb_online_store.mongodb
:members:
:undoc-members:
:show-inheritance:

feast.infra.online\_stores.mongodb\_online\_store.mongodb\_repo\_configuration module
---------------------------------------------------------------------------------------------

.. automodule:: feast.infra.online_stores.mongodb_online_store.mongodb_repo_configuration
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: feast.infra.online_stores.mongodb_online_store
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions sdk/python/docs/source/feast.infra.online_stores.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Subpackages
feast.infra.online_stores.hazelcast_online_store
feast.infra.online_stores.hbase_online_store
feast.infra.online_stores.milvus_online_store
feast.infra.online_stores.mongodb_online_store
feast.infra.online_stores.mysql_online_store
feast.infra.online_stores.postgres_online_store
feast.infra.online_stores.qdrant_online_store
Expand Down