uranio 0.1.63 → 0.1.65
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/.uranio/package.json +1 -1
- package/.uranio/src/client/mongodb.ts +14 -3
- package/README.md +2 -2
- package/package.json +2 -2
package/.uranio/package.json
CHANGED
|
@@ -27,15 +27,26 @@ export class MongoDBClient {
|
|
|
27
27
|
version: ServerApiVersion.v1,
|
|
28
28
|
strict: true,
|
|
29
29
|
deprecationErrors: true,
|
|
30
|
+
maxPoolSize: 10,
|
|
31
|
+
minPoolSize: 0,
|
|
30
32
|
},
|
|
31
33
|
} as MongoClientOptions;
|
|
32
34
|
this.client = new MongoClient(params.uri, options);
|
|
33
35
|
this.db = this.client.db(params.db_name, {ignoreUndefined: true});
|
|
34
36
|
}
|
|
35
37
|
public async connect() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
try {
|
|
39
|
+
// Check if the client is already connected by pinging the database
|
|
40
|
+
await this.client.db().command({ping: 1});
|
|
41
|
+
log.trace('MongoDB is already connected.');
|
|
42
|
+
} catch (error) {
|
|
43
|
+
log.trace('Connecting to MongoDB...');
|
|
44
|
+
await this.client.connect();
|
|
45
|
+
log.trace('MongoDB connected.');
|
|
46
|
+
}
|
|
47
|
+
// log.trace('Connecting...');
|
|
48
|
+
// await this.client.connect();
|
|
49
|
+
// log.trace('Connected.');
|
|
39
50
|
}
|
|
40
51
|
public async disconnect() {
|
|
41
52
|
log.trace('Disconnecting...');
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Uranio is the lightest Typescript Object Document Mapper (ODM) for MongoDB and
|
|
6
6
|
Object Relational Mapping (ORM) for MySQL.\
|
|
7
|
-
It creates a client for querying collections/
|
|
7
|
+
It creates a client for querying collections/tables in a database by just parsing
|
|
8
8
|
the types in a repository.
|
|
9
9
|
|
|
10
10
|
It is the simplest and fastest way to query a database without the need to build
|
|
@@ -13,7 +13,7 @@ a Data Access Layer (DAL) from the defined types.
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```
|
|
16
|
-
|
|
16
|
+
npm install uranio
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## How it works
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uranio",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"description": "Uranio is a type-safe ODM for MongoDB",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"inquirer": "^8.0.0",
|
|
64
64
|
"mongodb": "^6.3.0",
|
|
65
65
|
"mysql2": "^3.11.4",
|
|
66
|
-
"plutonio": "^0.7.
|
|
66
|
+
"plutonio": "^0.7.1",
|
|
67
67
|
"r4y": "^0.6.0",
|
|
68
68
|
"yaml": "^2.3.4"
|
|
69
69
|
}
|