@atscript/db-mongo 0.1.38 → 0.1.39
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 +60 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://atscript.moost.org/logo.svg" alt="Atscript" width="120" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@atscript/db-mongo</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Define your models once</strong> — get TypeScript types, runtime validation, and DB metadata from a single <code>.as</code> model.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://atscript.moost.org">Documentation</a> · <a href="https://atscript.moost.org/db/adapters/mongodb">MongoDB Adapter</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
MongoDB adapter for `@atscript/db`. Translates Atscript's portable query model into native MongoDB operations with support for Atlas Search, vector search, aggregation pipelines, capped collections, and the Convenient Transaction API.
|
|
18
|
+
|
|
19
|
+
Includes `MongoPlugin` for `@db.mongo.*` annotations and custom primitives (`mongo.objectId`, `mongo.vector`).
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @atscript/db-mongo mongodb
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { DbSpace } from '@atscript/db'
|
|
31
|
+
import { MongoAdapter } from '@atscript/db-mongo'
|
|
32
|
+
import { MongoClient } from 'mongodb'
|
|
33
|
+
|
|
34
|
+
const client = new MongoClient('mongodb://localhost:27017/myapp')
|
|
35
|
+
const db = new DbSpace(() => new MongoAdapter(client.db(), client))
|
|
36
|
+
const todos = db.getTable(TodoType)
|
|
37
|
+
|
|
38
|
+
await todos.insertOne({ title: 'Hello', done: false })
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- Full CRUD with native MongoDB operations
|
|
44
|
+
- Atlas Search: dynamic and static text indexes with analyzers and fuzzy matching
|
|
45
|
+
- Vector search via `@db.search.vector` with configurable dimensions and similarity
|
|
46
|
+
- Native relation loading via `$lookup` aggregation stages
|
|
47
|
+
- Aggregation pipeline support
|
|
48
|
+
- Array patch operations via `CollectionPatcher`
|
|
49
|
+
- Capped collections via `@db.mongo.capped`
|
|
50
|
+
- Auto-increment via atomic counter collection
|
|
51
|
+
- Convenient Transaction API with automatic retry
|
|
52
|
+
|
|
53
|
+
## Documentation
|
|
54
|
+
|
|
55
|
+
- [MongoDB Adapter Guide](https://atscript.moost.org/db/adapters/mongodb)
|
|
56
|
+
- [Full Documentation](https://atscript.moost.org)
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/db-mongo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "Mongodb plugin for atscript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"mongodb": "^6.17.0",
|
|
68
|
-
"@atscript/core": "^0.1.
|
|
69
|
-
"@atscript/
|
|
70
|
-
"@atscript/
|
|
68
|
+
"@atscript/core": "^0.1.39",
|
|
69
|
+
"@atscript/typescript": "^0.1.39",
|
|
70
|
+
"@atscript/db": "^0.1.39"
|
|
71
71
|
},
|
|
72
72
|
"build": [
|
|
73
73
|
{},
|