@mountsqli/mongodb 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -0
- package/package.json +9 -3
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @mountsqli/mongodb
|
|
2
|
+
|
|
3
|
+
MongoDB dialect for MountSQLi with native driver support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Document-based collections
|
|
8
|
+
- Flexible schema validation
|
|
9
|
+
- Aggregation pipeline support
|
|
10
|
+
- Change streams for real-time updates
|
|
11
|
+
- Transactions (with replica set)
|
|
12
|
+
- Native MongoDB operations
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @mountsqli/mongodb mongodb
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { mountsqli } from '@mountsqli/mongodb';
|
|
24
|
+
import { mongoCollection, text, integer, boolean } from '@mountsqli/mongodb';
|
|
25
|
+
|
|
26
|
+
// Define collection
|
|
27
|
+
const users = mongoCollection('users', {
|
|
28
|
+
id: text('id').primaryKey(),
|
|
29
|
+
name: text('name').notNull(),
|
|
30
|
+
email: text('email').notNull().unique(),
|
|
31
|
+
active: boolean('active').default(true).notNull(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Connect
|
|
35
|
+
const db = mountsqli('mongodb://localhost:27017/mydb');
|
|
36
|
+
|
|
37
|
+
// Use native MongoDB operations
|
|
38
|
+
const users = await db.collection('users')
|
|
39
|
+
.find({ active: true })
|
|
40
|
+
.toArray();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Use Cases
|
|
44
|
+
|
|
45
|
+
- **Document-heavy applications** — Flexible schema for varying data structures
|
|
46
|
+
- **Real-time applications** — Change streams for live updates
|
|
47
|
+
- **Analytics** — Aggregation pipeline for complex queries
|
|
48
|
+
- **Content management** — Nested documents for rich content
|
|
49
|
+
- **IoT** — Time-series data with flexible schemas
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
📖 [Documentation](https://mountsqli.vercel.app/docs/mongodb/setup)
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mountsqli/mongodb",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
},
|
|
11
11
|
"main": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
-
"files": [
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
14
18
|
"scripts": {
|
|
15
19
|
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
16
20
|
"dev": "tsup --watch",
|
|
@@ -24,7 +28,9 @@
|
|
|
24
28
|
"mongodb": "^6.0.0"
|
|
25
29
|
},
|
|
26
30
|
"peerDependenciesMeta": {
|
|
27
|
-
"mongodb": {
|
|
31
|
+
"mongodb": {
|
|
32
|
+
"optional": true
|
|
33
|
+
}
|
|
28
34
|
},
|
|
29
35
|
"devDependencies": {
|
|
30
36
|
"@types/node": "^22.0.0",
|