hola-server 0.3.14 → 0.3.15

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.
Files changed (2) hide show
  1. package/db/entity.js +3 -4
  2. package/package.json +1 -1
package/db/entity.js CHANGED
@@ -836,7 +836,7 @@ class Entity {
836
836
  for (let k = 0; k < ref_collection_fields.length; k++) {
837
837
  const ref_collection_field = ref_collection_fields[k];
838
838
  const ref_collection_entities = await refer_by_entity.get_refer_entities(ref_collection_field.name, collection_id_array, attr);
839
- ref_collection_entities && ref_collection_entities.length > 0 && ref_entities.push(...(ref_collection_entities.map(o => o["_id"] + "")));
839
+ ref_collection_entities && ref_collection_entities.length > 0 && ref_entities_ids.push(...(ref_collection_entities.map(o => o["_id"] + "")));
840
840
  }
841
841
  for (let k = 0; k < entities.length; k++) {
842
842
  const entity = entities[k];
@@ -847,9 +847,9 @@ class Entity {
847
847
 
848
848
  if (left_entities.length > 0) {
849
849
  if (ref_by_meta.ref_label) {
850
- has_refer_by_array.push(...entities.map(o => this.meta.collection + "<-" + ref_by_meta.collection + ":" + o[ref_by_meta.ref_label]));
850
+ has_refer_by_array.push(...left_entities.map(o => this.meta.collection + "<-" + ref_by_meta.collection + ":" + o[ref_by_meta.ref_label]));
851
851
  } else {
852
- has_refer_by_array.push(...entities.map(o => this.meta.collection + "<-" + ref_by_meta.collection + ":" + o["_id"] + ""));
852
+ has_refer_by_array.push(...left_entities.map(o => this.meta.collection + "<-" + ref_by_meta.collection + ":" + o["_id"] + ""));
853
853
  }
854
854
  }
855
855
  }
@@ -867,7 +867,6 @@ class Entity {
867
867
  * @returns true if has refered
868
868
  */
869
869
  async get_refer_entities(field_name, id_array, attr) {
870
- console.log(id_array);
871
870
  const query = { [field_name]: { "$in": id_array } };
872
871
  return await this.find(query, attr);
873
872
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hola-server",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "a meta programming framework used to build nodejs restful api",
5
5
  "main": "index.js",
6
6
  "scripts": {