Skip to content

Commit 11b961f

Browse files
Copilothotlong
andcommitted
Refactor memory driver to use Mingo for MongoDB-like queries
- Add mingo@^7.1.1 as dependency for MongoDB query engine - Replace custom filter/sort logic with Mingo Query API - Convert ObjectQL filters to MongoDB query format - Use Mingo for filtering, counting, distinct, updateMany, deleteMany - Keep manual sort implementation to avoid CJS build issues - Update package description to reflect Mingo integration - Update README and MIGRATION docs to mention Mingo - Maintain 100% backward compatibility with existing API Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 2a34915 commit 11b961f

5 files changed

Lines changed: 269 additions & 134 deletions

File tree

packages/drivers/memory/MIGRATION.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,35 @@
22

33
## Overview
44

5-
The Memory driver has been migrated to support the standard `DriverInterface` from `@objectstack/spec` while maintaining full backward compatibility with the existing `Driver` interface from `@objectql/types`.
5+
The Memory driver has been refactored to use **Mingo** (MongoDB query engine for in-memory objects) for query processing, while maintaining full backward compatibility with the existing `Driver` interface from `@objectql/types`. This brings MongoDB-like query capabilities to the in-memory driver.
66

7-
**Package Version**: 3.0.1 (maintained for changeset compatibility)
7+
**Package Version**: 4.0.0
88
**DriverInterface Version**: v4.0 compliant
99
**Completion Date**: January 23, 2026
10-
**Status**: ✅ Fully compliant with DriverInterface v4.0
10+
**Status**: ✅ Fully compliant with DriverInterface v4.0 and Mingo-powered
1111

12-
**Note**: The driver implements DriverInterface v4.0 specification, but the package version remains at 3.0.1 due to changeset fixed group constraints.
12+
## Key Changes
1313

14-
## What Changed
14+
### 1. Mingo Integration
1515

16-
### 1. Driver Metadata
16+
The driver now uses **Mingo** for query processing, which provides:
17+
18+
- **MongoDB Query Operators**: Full support for MongoDB query syntax
19+
- **High Performance**: Optimized query execution for in-memory data
20+
- **Standard Compliance**: MongoDB-compatible query semantics
21+
22+
#### What is Mingo?
23+
24+
Mingo is a MongoDB query language for in-memory JavaScript objects. It brings the power of MongoDB queries to client-side and server-side JavaScript applications without requiring a MongoDB server.
25+
26+
#### Benefits
27+
28+
- **Consistency**: Same query syntax as MongoDB
29+
- **Expressiveness**: Rich query operators ($gt, $lt, $in, $regex, etc.)
30+
- **Reliability**: Well-tested MongoDB query semantics
31+
- **Performance**: Optimized for in-memory operations
32+
33+
### 2. Driver Metadata
1734

1835
The driver now exposes metadata for ObjectStack compatibility:
1936

packages/drivers/memory/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Memory Driver for ObjectQL
22

3-
> **Production-Ready** - A high-performance in-memory driver for testing, development, and edge environments.
3+
> **Production-Ready** - A high-performance in-memory driver powered by Mingo for testing, development, and edge environments.
44
55
## Overview
66

7-
The Memory Driver is a zero-dependency, production-ready implementation of the ObjectQL Driver interface that stores data in JavaScript Maps. It provides full query support with high performance, making it ideal for scenarios where persistence is not required.
7+
The Memory Driver is a production-ready implementation of the ObjectQL Driver interface that stores data in JavaScript Maps and uses **Mingo** (MongoDB query engine for in-memory objects) for query processing. It provides full MongoDB-like query support with high performance, making it ideal for scenarios where persistence is not required.
88

99
## Features
1010

11-
-**Zero Dependencies** - No external packages required
11+
-**MongoDB Query Engine** - Powered by Mingo for MongoDB-compatible queries
1212
-**Full Query Support** - Filters, sorting, pagination, field projection
1313
-**High Performance** - No I/O overhead, all operations in-memory
1414
-**Bulk Operations** - createMany, updateMany, deleteMany

packages/drivers/memory/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@objectql/driver-memory",
33
"version": "4.0.0",
4-
"description": "In-memory driver for ObjectQL - Fast, zero-dependency storage with DriverInterface v4.0 compliance",
4+
"description": "In-memory driver for ObjectQL - Fast MongoDB-like query engine powered by Mingo with DriverInterface v4.0 compliance",
55
"keywords": [
66
"objectql",
77
"driver",
@@ -21,7 +21,8 @@
2121
},
2222
"dependencies": {
2323
"@objectql/types": "workspace:*",
24-
"@objectstack/spec": "^0.2.0"
24+
"@objectstack/spec": "^0.2.0",
25+
"mingo": "^7.1.1"
2526
},
2627
"devDependencies": {
2728
"@types/jest": "^29.0.0",

0 commit comments

Comments
 (0)