You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f8389fb
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: infra/website/docs/blog/mongodb-feast-integration.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
1
---
2
2
title: "Native MongoDB Support in Feast: One Database for Operational Data, Features, and Vectors"
3
-
description: Feast now ships first-class support for **MongoDB** as both an online and an offline store, plus native **Vector Search** for embedding-based retrieval. Machine Learning teams running on MongoDB can serve features at low latency, generate point-in-time-correct training datasets, and power RAG or recommender workloads, all from a single MongoDB Atlas cluster, with no separate cache, no separate warehouse, and no parallel vector database to keep in sync.
3
+
description: Feast now ships first-class support for MongoDB as both an online and an offline store, plus native Vector Search for embedding-based retrieval. Machine Learning teams running on MongoDB can serve features at low latency, generate point-in-time-correct training datasets, and power RAG or recommender workloads, all from a single MongoDB Atlas cluster, with no separate cache, no separate warehouse, and no parallel vector database to keep in sync.
## **The three-database problem in production ML**
14
+
## The three-database problem in production ML
15
15
16
16
A typical Feast deployment runs three different databases:
17
17
@@ -23,41 +23,41 @@ That's three sets of credentials, three security postures, three monitoring stac
23
23
24
24
For teams whose operational data already lives in MongoDB, this was especially painful. Until now, Feast had no native MongoDB option so teams either stood up parallel infrastructure they didn't want, or settled for community plugins of varying maturity.
25
25
26
-
With this release, both types of the feature store run on MongoDB \- same connection string, same auth, same backups, same observability. The features sit next to the operational data they were derived from.
26
+
With this release, both types of the feature store run on MongoDB - same connection string, same auth, same backups, same observability. The features sit next to the operational data they were derived from.
27
27
28
-
## **What's in the integration**
28
+
## What's in the integration
29
29
30
30
Three components ship together as generally available:
Available in Feast `v0.61.0` and above. Built on the official PyMongo driver, with both sync and native async paths (the async implementation uses PyMongo's `AsyncMongoClient`). It supports `online_write_batch`, `online_read`, and their async equivalents.
35
35
36
36
Features from multiple feature views for the same entity are colocated in a single MongoDB collection keyed by the serialized entity key, so a read for an entity is a single primary-key lookup, not a fan-out across collections.
37
37
38
-
### **2\. MongoDBOfflineStore \- historical retrieval and training-set generation**
38
+
### 2. MongoDBOfflineStore - historical retrieval and training-set generation
39
39
40
40
Available in `v0.63.0` and above. Uses the MongoDB aggregation framework for retrieval, with `pandas.merge_asof` for the point-in-time join when entities repeat across timestamps. Ships with `MongoDBSource` (the `DataSource` class), `offline_write_batch` for ingest, and `persist` to write joined results to Parquet for downstream training pipelines.
41
41
42
-
### **3\. MongoDB Vector Search \- embeddings as first-class features**
42
+
### 3. MongoDB Vector Search - embeddings as first-class features
43
43
44
-
When you set `vector_enabled: true` on the online store, Feast automatically creates and manages MongoDB vector search indexes on any `FeatureView` field marked with `vector_index=True`. The `retrieve_online_documents_v2()` method runs a `$vectorSearch` aggregation under the hood and returns nearest-neighbor results as `(event_ts, entity_key, feature_dict)` tuples with a similarity score \- with `top_k` limiting and configurable distance metrics (`cosine`, `dot product`, `euclidean`).
44
+
When you set `vector_enabled: true` on the online store, Feast automatically creates and manages MongoDB vector search indexes on any `FeatureView` field marked with `vector_index=True`. The `retrieve_online_documents_v2()` method runs a `$vectorSearch` aggregation under the hood and returns nearest-neighbor results as `(event_ts, entity_key, feature_dict)` tuples with a similarity score - with `top_k` limiting and configurable distance metrics (`cosine`, `dot product`, `euclidean`).
45
45
46
-
The result: a team running RAG, recommenders, or agent workloads can store, serve, and similarity-search feature embeddings in the same Atlas cluster as their other features with no separate vector database to bolt on.
46
+
The result: a team running RAG, recommenders, or agent workloads can store, serve, and similarity-search feature embeddings in the same Atlas cluster as their other features — with no separate vector database to bolt on.
47
47
48
48
## **Quick start**
49
49
50
-
### **Install**
50
+
### Install
51
51
52
52
```shell
53
53
pip install 'feast[mongodb]'
54
54
```
55
55
56
-
### **Configure your `feature_store.yaml`**
56
+
### Configure your `feature_store.yaml`
57
57
58
58
Point both the online and offline store at the same Atlas cluster. No separate Atlas feature flag or opt-in required.
59
59
60
-
```
60
+
```yaml
61
61
project: my_feature_repo
62
62
registry: data/registry.db
63
63
provider: local
@@ -75,7 +75,7 @@ offline_store:
75
75
entity_key_serialization_version: 3
76
76
```
77
77
78
-
### **Define a feature view backed by `MongoDBSource`**
78
+
### Define a feature view backed by `MongoDBSource`
@@ -131,13 +131,13 @@ features = store.get_online_features(
131
131
).to_dict()
132
132
```
133
133
134
-
That's it. Same connection string, same auth model, same cluster \- features in, features out.
134
+
That's it. Same connection string, same auth model, same cluster - features in, features out.
135
135
136
-
## **RAG and embeddings: vector search in the same cluster**
136
+
## RAG and embeddings: vector search in the same cluster
137
137
138
138
If you're building a RAG pipeline, a recommender, or an agent that needs nearest-neighbor lookup over feature embeddings, the online store doubles as a vector store when `vector_enabled` is set:
Under the hood, this becomes a `$vectorSearch` aggregation against your Atlas cluster \- no second system to provision, no vector data to keep in sync with the rest of your features.
191
+
Under the hood, this becomes a `$vectorSearch` aggregation against your Atlas cluster - no second system to provision, no vector data to keep in sync with the rest of your features.
192
192
193
-
## **Why this matters**
193
+
## Why this matters
194
194
195
195
A few reasons we think this lands in the right place for ML teams already on MongoDB:
196
196
@@ -200,11 +200,11 @@ A few reasons we think this lands in the right place for ML teams already on Mon
200
200
* **Flexible schema where it helps.** Feature engineering is iterative. MongoDB's document model means adding a field to a feature view doesn't require a schema migration on day one.
201
201
* **Async serving when you need it.** The online store ships a native async path on `AsyncMongoClient`, so feature lookups don't block the rest of your serving stack.
202
202
203
-
## **Where to next**
203
+
## Where to next
204
204
205
-
***Online store reference:**[Feast docs \- MongoDB online store](https://docs.feast.dev/master/reference/online-stores/mongodb)
206
-
***Offline store reference:**[Feast docs \- MongoDB offline store](https://docs.feast.dev/master/reference/offline-stores/mongodb)
***Tutorial:**[Integrate MongoDB with Feast](https://www.mongodb.com/docs/atlas/ai-integrations/feast/)
205
+
* **Online store reference:** [Feast docs - MongoDB online store](https://docs.feast.dev/master/reference/online-stores/mongodb)
206
+
* **Offline store reference:** [Feast docs - MongoDB offline store](https://docs.feast.dev/master/reference/offline-stores/mongodb)
* **Tutorial:** [Integrate MongoDB with Feast](https://www.mongodb.com/docs/atlas/ai-integrations/feast/)
209
209
210
-
If you're already on MongoDB and want to standardize your ML stack on a single backend, this is the time to try it. Spin up a feature repo, point both stores at your cluster, and let us know how it goes \- issues and PRs welcome on GitHub.
210
+
If you're already on MongoDB and want to standardize your ML stack on a single backend, this is the time to try it. Spin up a feature repo, point both stores at your cluster, and let us know how it goes - issues and PRs welcome on GitHub.
0 commit comments