@twin.org/entity-storage-connector-mongodb 0.0.1-next.28 → 0.0.1-next.30

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.
@@ -210,11 +210,10 @@ class MongoDbEntityStorageConnector {
210
210
  if (conditions) {
211
211
  this.buildQueryParameters("", conditions, filter);
212
212
  }
213
- const sort = {};
213
+ const sort = new Map();
214
214
  if (Array.isArray(sortProperties)) {
215
215
  for (const sortProperty of sortProperties) {
216
- const direction = sortProperty.sortDirection === entity.SortDirection.Ascending ? 1 : -1;
217
- sort[sortProperty.property] = direction;
216
+ sort.set(sortProperty.property, sortProperty.sortDirection);
218
217
  }
219
218
  }
220
219
  const projection = {};
@@ -1,5 +1,5 @@
1
1
  import { Guards, BaseError, Is, GeneralError } from '@twin.org/core';
2
- import { EntitySchemaFactory, EntitySchemaHelper, SortDirection, LogicalOperator, ComparisonOperator } from '@twin.org/entity';
2
+ import { EntitySchemaFactory, EntitySchemaHelper, LogicalOperator, ComparisonOperator } from '@twin.org/entity';
3
3
  import { LoggingConnectorFactory } from '@twin.org/logging-models';
4
4
  import { MongoClient } from 'mongodb';
5
5
 
@@ -208,11 +208,10 @@ class MongoDbEntityStorageConnector {
208
208
  if (conditions) {
209
209
  this.buildQueryParameters("", conditions, filter);
210
210
  }
211
- const sort = {};
211
+ const sort = new Map();
212
212
  if (Array.isArray(sortProperties)) {
213
213
  for (const sortProperty of sortProperties) {
214
- const direction = sortProperty.sortDirection === SortDirection.Ascending ? 1 : -1;
215
- sort[sortProperty.property] = direction;
214
+ sort.set(sortProperty.property, sortProperty.sortDirection);
216
215
  }
217
216
  }
218
217
  const projection = {};
@@ -1,4 +1,4 @@
1
- import { type EntityCondition, type IEntitySchema, SortDirection } from "@twin.org/entity";
1
+ import { type EntityCondition, type IEntitySchema, type SortDirection } from "@twin.org/entity";
2
2
  import type { IEntityStorageConnector } from "@twin.org/entity-storage-models";
3
3
  import type { IMongoDbEntityStorageConnectorConstructorOptions } from "./models/IMongoDbEntityStorageConnectorConstructorOptions";
4
4
  /**
package/docs/changelog.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @twin.org/entity-storage-connector-mongodb - Changelog
2
2
 
3
+ ## [0.0.1-next.30](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-mongodb-v0.0.1-next.29...entity-storage-connector-mongodb-v0.0.1-next.30) (2025-06-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/entity-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
16
+ * devDependencies
17
+ * @twin.org/entity-storage-connector-memory bumped from 0.0.1-next.29 to 0.0.1-next.30
18
+
19
+ ## [0.0.1-next.29](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-mongodb-v0.0.1-next.28...entity-storage-connector-mongodb-v0.0.1-next.29) (2025-04-17)
20
+
21
+
22
+ ### Features
23
+
24
+ * use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * dependencies
31
+ * @twin.org/entity-storage-models bumped from 0.0.1-next.28 to 0.0.1-next.29
32
+ * devDependencies
33
+ * @twin.org/entity-storage-connector-memory bumped from 0.0.1-next.28 to 0.0.1-next.29
34
+
3
35
  ## [0.0.1-next.28](https://github.com/twinfoundation/entity-storage/compare/entity-storage-connector-mongodb-v0.0.1-next.27...entity-storage-connector-mongodb-v0.0.1-next.28) (2025-04-09)
4
36
 
5
37
 
@@ -4,7 +4,9 @@ Class for performing entity storage operations using MongoDb.
4
4
 
5
5
  ## Type Parameters
6
6
 
7
- **T** = `unknown`
7
+ ### T
8
+
9
+ `T` = `unknown`
8
10
 
9
11
  ## Implements
10
12
 
@@ -12,9 +14,9 @@ Class for performing entity storage operations using MongoDb.
12
14
 
13
15
  ## Constructors
14
16
 
15
- ### new MongoDbEntityStorageConnector()
17
+ ### Constructor
16
18
 
17
- > **new MongoDbEntityStorageConnector**\<`T`\>(`options`): [`MongoDbEntityStorageConnector`](MongoDbEntityStorageConnector.md)\<`T`\>
19
+ > **new MongoDbEntityStorageConnector**\<`T`\>(`options`): `MongoDbEntityStorageConnector`\<`T`\>
18
20
 
19
21
  Create a new instance of MongoDbEntityStorageConnector.
20
22
 
@@ -28,7 +30,7 @@ The options for the connector.
28
30
 
29
31
  #### Returns
30
32
 
31
- [`MongoDbEntityStorageConnector`](MongoDbEntityStorageConnector.md)\<`T`\>
33
+ `MongoDbEntityStorageConnector`\<`T`\>
32
34
 
33
35
  ## Properties
34
36
 
@@ -46,7 +48,7 @@ Runtime name for the class.
46
48
 
47
49
  ### bootstrap()
48
50
 
49
- > **bootstrap**(`nodeLoggingConnectorType`?): `Promise`\<`boolean`\>
51
+ > **bootstrap**(`nodeLoggingConnectorType?`): `Promise`\<`boolean`\>
50
52
 
51
53
  Initialize the MongoDb environment.
52
54
 
@@ -90,7 +92,7 @@ The schema for the entities.
90
92
 
91
93
  ### get()
92
94
 
93
- > **get**(`id`, `secondaryIndex`?, `conditions`?): `Promise`\<`undefined` \| `T`\>
95
+ > **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`undefined` \| `T`\>
94
96
 
95
97
  Get an entity from MongoDb.
96
98
 
@@ -128,7 +130,7 @@ The object if it can be found or undefined.
128
130
 
129
131
  ### set()
130
132
 
131
- > **set**(`entity`, `conditions`?): `Promise`\<`void`\>
133
+ > **set**(`entity`, `conditions?`): `Promise`\<`void`\>
132
134
 
133
135
  Set an entity.
134
136
 
@@ -160,7 +162,7 @@ The id of the entity.
160
162
 
161
163
  ### remove()
162
164
 
163
- > **remove**(`id`, `conditions`?): `Promise`\<`void`\>
165
+ > **remove**(`id`, `conditions?`): `Promise`\<`void`\>
164
166
 
165
167
  Remove the entity.
166
168
 
@@ -192,7 +194,7 @@ Nothing.
192
194
 
193
195
  ### query()
194
196
 
195
- > **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
197
+ > **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
196
198
 
197
199
  Find all the entities which match the conditions.
198
200
 
@@ -230,7 +232,7 @@ The suggested number of entities to return in each chunk, in some scenarios can
230
232
 
231
233
  #### Returns
232
234
 
233
- `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor`: `string`; \}\>
235
+ `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
234
236
 
235
237
  All the entities for the storage matching the conditions,
236
238
  and a cursor which can be used to request more entities.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/entity-storage-connector-mongodb",
3
- "version": "0.0.1-next.28",
3
+ "version": "0.0.1-next.30",
4
4
  "description": "Entity Storage connector implementation using MongoDb storage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,10 +16,10 @@
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
18
  "@twin.org/entity": "next",
19
- "@twin.org/entity-storage-models": "0.0.1-next.28",
19
+ "@twin.org/entity-storage-models": "0.0.1-next.30",
20
20
  "@twin.org/logging-models": "next",
21
21
  "@twin.org/nameof": "next",
22
- "mongodb": "^6.14.2"
22
+ "mongodb": "6.17.0"
23
23
  },
24
24
  "main": "./dist/cjs/index.cjs",
25
25
  "module": "./dist/esm/index.mjs",