beanbagdb 0.8.9 → 0.8.11
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/package.json +1 -1
- package/src/index.js +18 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -845,8 +845,24 @@ export class BeanBagDB {
|
|
|
845
845
|
let data = await this.search({selector:{
|
|
846
846
|
"schema":"system_edge",
|
|
847
847
|
"$or":[ {'data.node1':{"$in":[node]}},{'data.node2':{"$in":[node]}}]
|
|
848
|
-
},fields:["_id","meta","
|
|
849
|
-
|
|
848
|
+
},fields:["_id","meta","data"]})
|
|
849
|
+
|
|
850
|
+
// console.log(rel_docs)
|
|
851
|
+
if(data.docs.length>0){
|
|
852
|
+
let record_details = []
|
|
853
|
+
data.docs.map(itm=>{record_details.push(itm.data.node1);record_details.push(itm.data.node2)})
|
|
854
|
+
let records = await this.search({selector:{"_id":{"$in":record_details}},fields:["_id","meta"]})
|
|
855
|
+
let details = {}
|
|
856
|
+
records.docs.map(itm=>{details[itm._id] = itm.meta})
|
|
857
|
+
let edges = []
|
|
858
|
+
data.docs.map(itm=>{
|
|
859
|
+
edges.push({node1: itm.data.node1, node2: itm.data.node2, label: itm.data.edge_name, edge_id: itm._id })
|
|
860
|
+
})
|
|
861
|
+
return{edges, details }
|
|
862
|
+
}else{
|
|
863
|
+
return {}
|
|
864
|
+
}
|
|
865
|
+
|
|
850
866
|
}else{
|
|
851
867
|
throw new ValidationError("Doc not found")
|
|
852
868
|
}
|