Skip to content

Commit d5defca

Browse files
Copilothotlong
andcommitted
docs: Update MongoDB driver README with QueryAST info
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent bb454d6 commit d5defca

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

packages/drivers/mongo/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
MongoDB driver for ObjectQL. Supports basic CRUD, filtering, and aggregation pipelines on MongoDB.
44

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+
57
## Installation
68

79
```bash
@@ -24,3 +26,59 @@ const objectql = new ObjectQL({
2426
}
2527
});
2628
```
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 = await driver.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 = await driver.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.
81+
82+
## License
83+
84+
MIT

0 commit comments

Comments
 (0)