@opra/mongodb 1.28.4 → 1.28.5
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/LICENSE +1 -1
- package/README.md +51 -3
- package/package.json +5 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,19 +1,67 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<a href="https://oprajs.com">
|
|
4
|
+
<img src="https://oprajs.com/img/opra-header-block.webp" width="880" alt="OPRA — Open Platform for Rich APIs" />
|
|
5
|
+
</a>
|
|
6
|
+
|
|
1
7
|
# @opra/mongodb
|
|
2
8
|
|
|
9
|
+
MongoDB data service adapter for the OPRA framework
|
|
10
|
+
|
|
3
11
|
[![NPM Version][npm-image]][npm-url]
|
|
4
12
|
[![NPM Downloads][downloads-image]][downloads-url]
|
|
5
13
|
[![CI Tests][ci-test-image]][ci-test-url]
|
|
6
14
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
7
15
|
|
|
16
|
+
[🌐 Documentation](https://oprajs.com) · [🚀 Getting Started](https://oprajs.com/docs/introduction) · [📦 Packages](https://github.com/panates/opra#packages) · [💬 Issues](https://github.com/panates/opra/issues)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
MongoDB data service adapter for the [OPRA](https://oprajs.com) framework. Connects your MongoDB collections to OPRA's operation model — pagination, filtering, sorting, and projections work out of the box.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **`MongoService`** — Base service with MongoClient or database integration and transaction support
|
|
27
|
+
- **`MongoCollectionService`** — Ready-made CRUD service for a MongoDB collection
|
|
28
|
+
- **`MongoEntityService`** — Entity-level service for single-document operations
|
|
29
|
+
- **`MongoAdapter`** — Utility namespace: `prepareFilter()`, `prepareSort()`, `prepareProjection()`, `prepareKeyValues()`
|
|
30
|
+
- Automatic translation of OPRA filter DSL to MongoDB query objects
|
|
31
|
+
- ObjectId handling and schema-aware field projection
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
8
34
|
|
|
9
|
-
|
|
10
|
-
|
|
35
|
+
```bash
|
|
36
|
+
npm install @opra/mongodb
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { MongoCollectionService } from '@opra/mongodb';
|
|
43
|
+
|
|
44
|
+
@HttpController({ path: 'users' })
|
|
45
|
+
export class UsersController extends MongoCollectionService<User> {
|
|
46
|
+
constructor(db: Db) {
|
|
47
|
+
super(User, db.collection('users'));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@HttpOperation.Entity.FindMany({ type: User })
|
|
51
|
+
findMany() { return super.findMany(); }
|
|
52
|
+
|
|
53
|
+
@HttpOperation.Entity.GetOne({ type: User })
|
|
54
|
+
@HttpOperation.PathParam('id', 'objectId')
|
|
55
|
+
getOne(id: ObjectId) { return super.getOne(id); }
|
|
56
|
+
}
|
|
57
|
+
```
|
|
11
58
|
|
|
12
59
|
## Node Compatibility
|
|
13
|
-
- node >= 20.x
|
|
14
60
|
|
|
61
|
+
- node >= 20.x
|
|
15
62
|
|
|
16
63
|
## License
|
|
64
|
+
|
|
17
65
|
Available under [MIT](LICENSE) license.
|
|
18
66
|
|
|
19
67
|
[npm-image]: https://img.shields.io/npm/v/@opra/mongodb
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/mongodb",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.5",
|
|
4
4
|
"description": "Opra MongoDB adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://www.oprajs.com",
|
|
7
8
|
"dependencies": {
|
|
8
9
|
"@jsopen/objects": "^2.2.2",
|
|
9
10
|
"tslib": "^2.8.1",
|
|
10
11
|
"valgen": "^6.2.0"
|
|
11
12
|
},
|
|
12
13
|
"peerDependencies": {
|
|
13
|
-
"@opra/common": "^1.28.
|
|
14
|
-
"@opra/core": "^1.28.
|
|
15
|
-
"@opra/http": "^1.28.
|
|
14
|
+
"@opra/common": "^1.28.5",
|
|
15
|
+
"@opra/core": "^1.28.5",
|
|
16
|
+
"@opra/http": "^1.28.5",
|
|
16
17
|
"mongodb": "^7.0.0"
|
|
17
18
|
},
|
|
18
19
|
"exports": {
|