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
Copy file name to clipboardExpand all lines: packages/drivers/mongo/README.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
MongoDB driver for ObjectQL. Supports basic CRUD, filtering, and aggregation pipelines on MongoDB.
4
4
5
+
**Now with ObjectStack QueryAST support!** This driver implements both the legacy `Driver` interface and the new `DriverInterface` from `@objectstack/spec` for seamless integration with the ObjectStack ecosystem.
6
+
5
7
## Installation
6
8
7
9
```bash
@@ -24,3 +26,59 @@ const objectql = new ObjectQL({
24
26
}
25
27
});
26
28
```
29
+
30
+
## Features
31
+
32
+
- ✅ **100% Backward Compatible** - All existing code continues to work
33
+
- ✅ **QueryAST Support** - Supports the new `@objectstack/spec` query format
34
+
- ✅ **Smart ID Mapping** - Automatic conversion between `id` (API) and `_id` (MongoDB)
35
+
- ✅ **Full-Text Search** - MongoDB text search capabilities
36
+
- ✅ **Array & JSON Fields** - Native BSON support for complex data types
37
+
- ✅ **Aggregation Pipelines** - Native MongoDB aggregation support
38
+
39
+
## Driver Metadata
40
+
41
+
```typescript
42
+
console.log(driver.name); // 'MongoDriver'
43
+
console.log(driver.version); // '3.0.1'
44
+
console.log(driver.supports);
45
+
// {
46
+
// transactions: true,
47
+
// joins: false,
48
+
// fullTextSearch: true,
49
+
// jsonFields: true,
50
+
// arrayFields: true
51
+
// }
52
+
```
53
+
54
+
## QueryAST Format
55
+
56
+
The driver now supports both legacy and QueryAST formats:
57
+
58
+
### Legacy Format
59
+
```typescript
60
+
const results =awaitdriver.find('users', {
61
+
filters: [['age', '>', 18]],
62
+
sort: [['name', 'asc']],
63
+
limit: 10,
64
+
skip: 0
65
+
});
66
+
```
67
+
68
+
### QueryAST Format
69
+
```typescript
70
+
const results =awaitdriver.find('users', {
71
+
filters: [['age', '>', 18]],
72
+
sort: [{ field: 'name', order: 'asc' }],
73
+
top: 10, // Instead of 'limit'
74
+
skip: 0
75
+
});
76
+
```
77
+
78
+
## Migration Guide
79
+
80
+
See [MIGRATION.md](./MIGRATION.md) for detailed information about the ObjectStack migration and QueryAST format support.
0 commit comments