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
A production-ready MongoDB implementation of the `HtDataClient` interface, designed to connect Dart and Flutter applications to a MongoDB backend. This package is part of the Headlines Toolkit (HT) ecosystem.
7
+
A production-ready MongoDB implementation of the `DataClient` interface, designed to connect Dart and Flutter applications to a MongoDB backend. This package is part of the [**Flutter News App - Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code).
8
8
9
9
## Description
10
10
11
-
`HtDataMongodb` provides a robust, concrete implementation of the `HtDataClient` interface using the `mongo_dart` package. It acts as the bridge between your application's repositories and a MongoDB database.
11
+
`DataMongodb` provides a robust, concrete implementation of the `DataClient` interface using the `mongo_dart` package. It acts as the bridge between your application's repositories and a MongoDB database.
12
12
13
-
It translates the abstract, high-level data requests from the `HtDataClient` interface—including rich filters, multi-field sorting, and cursor-based pagination—into native, efficient MongoDB queries.
13
+
It translates the abstract, high-level data requests from the `DataClient` interface—including rich filters, multi-field sorting, and cursor-based pagination—into native, efficient MongoDB queries.
14
14
15
-
A key feature of this implementation is its **ID management strategy**. It ensures that the application layer remains the source of truth for a document's ID by mapping the model's `id` string to the database's `_id` field. This is crucial for correctly handling both global documents (like headlines) and user-owned documents (like settings), where the document's `_id` must match the user's ID. For a deeper explanation, see the documentation within the `HtDataMongodb` class.
15
+
A key feature of this implementation is its **ID management strategy**. It ensures that the application layer remains the source of truth for a document's ID by mapping the model's `id` string to the database's `_id` field. This is crucial for correctly handling both global documents (like headlines) and user-owned documents (like settings), where the document's `_id` must match the user's ID. For a deeper explanation, see the documentation within the `DataMongodb` class.
16
16
17
17
## Getting Started
18
18
19
19
This package is intended to be used as a dependency in backend services (like a Dart Frog API) or applications that connect directly to MongoDB.
20
20
21
-
To use this package, add `ht_data_mongodb` and its peer dependencies to your `pubspec.yaml`.
21
+
To use this package, add `data_mongodb` and its peer dependencies to your `pubspec.yaml`.
22
22
23
23
```yaml
24
24
dependencies:
25
-
#ht_data_client defines the interface this package implements.
26
-
ht_data_client:
25
+
#data_client defines the interface this package implements.
-**Handles ID Management**: Faithfully maps the application-level `id` string to the database `_id`, preserving data integrity for all document types.
49
49
-**Supports Multiple Data Models**: Correctly handles both global documents (e.g., `Headline`) and user-owned documents (e.g., `UserAppSettings`) where the document `_id` serves as the foreign key to the user.
50
-
- Throws standard exceptions from `package:ht_shared` for consistent error handling.
50
+
- Throws standard exceptions from `package:core` for consistent error handling.
51
51
- Implements `count` for efficient document counting.
52
52
- Implements `aggregate` to execute powerful, server-side aggregation pipelines.
53
53
-**Partial Text Search**: Translates a `q` filter parameter into a case-insensitive (`$regex`) across designated searchable fields.
54
54
55
55
## Usage
56
56
57
-
Here's a basic example of how to use `HtDataMongodb` with a simple `Product` model.
57
+
Here's a basic example of how to use `DataMongodb` with a simple `Product` model.
This package is licensed under the [PolyForm Free Trial 1.0.0](/LICENSE). Please review the terms before use.
156
+
## 🔑 Licensing
157
+
158
+
This package is source-available and licensed under the [PolyForm Free Trial 1.0.0](LICENSE). Please review the terms before use.
159
+
160
+
For commercial licensing options that grant the right to build and distribute unlimited applications, please visit the main [**Flutter News App - Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code) organization.
0 commit comments