grafio-mongo 3.3.0 → 3.4.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.
@@ -33,7 +33,7 @@ class MongoStorageProvider {
33
33
  }
34
34
  async ensureIndexes() {
35
35
  await this._nodes.createIndex({ graphId: 1, id: 1 }, { unique: true, name: 'node_graph_id_unique' });
36
- await this._nodes.createIndex({ graphId: 1, type: 1 }, { name: 'node_graph_type' });
36
+ await this._nodes.createIndex({ graphId: 1, labels: 1 }, { name: 'node_graph_labels' });
37
37
  await this._edges.createIndex({ graphId: 1, id: 1 }, { unique: true, name: 'edge_graph_id_unique' });
38
38
  await this._edges.createIndex({ graphId: 1, type: 1 }, { name: 'edge_graph_type' });
39
39
  await this._edges.createIndex({ graphId: 1, sourceId: 1 }, { name: 'edge_graph_source' });
@@ -62,7 +62,7 @@ class MongoStorageProvider {
62
62
  await this._nodes.insertOne({
63
63
  id: node.id,
64
64
  graphId: this._graphId,
65
- type: node.type,
65
+ labels: node.labels,
66
66
  createdOn: node.createdOn,
67
67
  updatedOn: node.updatedOn,
68
68
  properties: node.properties,
@@ -357,7 +357,7 @@ class MongoStorageProvider {
357
357
  const nodeDocs = data.nodes.map(n => ({
358
358
  id: n.id,
359
359
  graphId: this._graphId,
360
- type: n.type,
360
+ labels: n.labels,
361
361
  createdOn: n.createdOn ?? Date.now(),
362
362
  updatedOn: n.updatedOn ?? Date.now(),
363
363
  properties: n.properties,
@@ -592,7 +592,7 @@ class MongoStorageProvider {
592
592
  const andConditions = [];
593
593
  if (options?.filter) {
594
594
  if (options.filter.types && options.filter.types.length > 0) {
595
- filter.type = { $in: options.filter.types };
595
+ filter.labels = { $in: options.filter.types };
596
596
  }
597
597
  if (options.filter.properties && options.filter.properties.length > 0) {
598
598
  for (const prop of options.filter.properties) {
@@ -734,7 +734,7 @@ class MongoStorageProvider {
734
734
  _docToNode(doc) {
735
735
  return {
736
736
  id: doc.id,
737
- type: doc.type,
737
+ labels: doc.labels,
738
738
  createdOn: doc.createdOn,
739
739
  updatedOn: doc.updatedOn,
740
740
  properties: doc.properties,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grafio-mongo",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "MongoDB storage backend for grafio",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "peerDependencies": {},
18
18
  "dependencies": {
19
- "grafio": ">=7.2.0",
19
+ "grafio": ">=7.4.0",
20
20
  "mongodb": ">=5.0.0"
21
21
  },
22
22
  "devDependencies": {