@medyll/idae-db 0.7.0 → 0.8.0
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 +2 -99
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,102 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
@medyll/idae-db is a flexible and powerful library for interacting with various databases, with a particular focus on MongoDB support.
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npm install @medyll/idae-db
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Key Features
|
|
13
|
-
|
|
14
|
-
- Robust support for MongoDB
|
|
15
|
-
- Unified interface for different types of databases
|
|
16
|
-
- Efficient connection management
|
|
17
|
-
- Intuitive and flexible API
|
|
18
|
-
|
|
19
|
-
## Quick Start with MongoDB
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
import { IdaeDb, DbType } from '@medyll/idae-db';
|
|
23
|
-
|
|
24
|
-
async function main() {
|
|
25
|
-
// Initialize MongoDB connection
|
|
26
|
-
const mongoDb = IdaeDb.init('mongodb://localhost:27017', {
|
|
27
|
-
dbType: DbType.MONGODB,
|
|
28
|
-
dbScope: 'myapp_'
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// Create a connection
|
|
32
|
-
await mongoDb.db('example_db');
|
|
33
|
-
|
|
34
|
-
// Use the 'users' collection
|
|
35
|
-
const usersCollection = mongoDb.collection('users');
|
|
36
|
-
|
|
37
|
-
// Insert a document
|
|
38
|
-
await usersCollection.update('user1', {
|
|
39
|
-
name: 'John Doe',
|
|
40
|
-
email: 'john@example.com',
|
|
41
|
-
age: 30
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Find a document
|
|
45
|
-
const user = await usersCollection.findOne({ query: { email: 'john@example.com' } });
|
|
46
|
-
console.log('Found user:', user);
|
|
47
|
-
|
|
48
|
-
// Close the connection
|
|
49
|
-
await mongoDb.closeConnection();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
main().catch(console.error);
|
|
2
|
+
```json
|
|
3
|
+
"description": "@medyll/idae-db is a flexible and powerful library for interacting with various databases, with a particular focus on MongoDB support. It offers robust connection management, an intuitive API, and simplified CRUD operations."
|
|
53
4
|
```
|
|
54
5
|
|
|
55
|
-
## MongoDB Features
|
|
56
|
-
|
|
57
|
-
- Easy creation and management of connections
|
|
58
|
-
- Simplified CRUD operations
|
|
59
|
-
- Support for complex queries
|
|
60
|
-
- Index management
|
|
61
|
-
- Transactions (coming soon)
|
|
62
|
-
|
|
63
|
-
## Advanced Configuration
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
const mongoDb = IdaeDb.init('mongodb://localhost:27017', {
|
|
67
|
-
dbType: DbType.MONGODB,
|
|
68
|
-
dbScope: 'myapp_',
|
|
69
|
-
dbScopeSeparator: '_',
|
|
70
|
-
idaeModelOptions: {
|
|
71
|
-
// Model-specific options
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## MongoDB API
|
|
77
|
-
|
|
78
|
-
- `collection(name: string)`: Access a MongoDB collection
|
|
79
|
-
- `find(params)`: Search for documents
|
|
80
|
-
- `findOne(params)`: Find a single document
|
|
81
|
-
- `update(id, data)`: Update a document
|
|
82
|
-
- `deleteById(id)`: Delete a document by ID
|
|
83
|
-
- `createIndex(fieldOrSpec, options)`: Create an index on the collection
|
|
84
|
-
|
|
85
|
-
## Connection Management
|
|
86
|
-
|
|
87
|
-
- Efficiently managed multiple connections
|
|
88
|
-
- Automatic closure of connections
|
|
89
|
-
|
|
90
|
-
## Roadmap
|
|
91
|
-
|
|
92
|
-
- Enhanced support for other databases (MySQL, ChromaDB)
|
|
93
|
-
- Advanced features for MongoDB (aggregations, watch)
|
|
94
|
-
- Performance optimizations
|
|
95
|
-
|
|
96
|
-
## Contribution
|
|
97
|
-
|
|
98
|
-
Contributions are welcome! Feel free to open issues or submit pull requests.
|
|
99
|
-
|
|
100
|
-
## License
|
|
101
|
-
|
|
102
|
-
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medyll/idae-db",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "@medyll/idae-db is a flexible and powerful library for interacting with various databases, with a particular focus on MongoDB support. It offers robust connection management, an intuitive API, and simplified CRUD operations.",
|
|
4
5
|
"scripts": {
|
|
5
6
|
"dev": "vite dev",
|
|
6
7
|
"build": "vite build && npm run package",
|
|
@@ -56,4 +57,4 @@
|
|
|
56
57
|
"dependencies": {
|
|
57
58
|
"chromadb": "^1.8.1"
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
+
}
|