hola-server 0.5.2 → 0.5.3

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 -1
  2. package/package.json +1 -1
package/db/entity.js CHANGED
@@ -127,7 +127,9 @@ class Entity {
127
127
  //refer field
128
128
  const refer_entity = new Entity(get_entity_meta(search_field.ref));
129
129
  const oids = await refer_entity.find_by_ref_value(value, { _id: 1 }, this.meta.collection);
130
- if (oids.length > 0) {
130
+ if (oids.length == 1) {
131
+ and_array.push({ [search_field.name]: oids.map(o => o._id + "")[0] });
132
+ } else if (oids.length > 1) {
131
133
  and_array.push({ [search_field.name]: { "$in": oids.map(o => o._id + "") } });
132
134
  }
133
135
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hola-server",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "a meta programming framework used to build nodejs restful api",
5
5
  "main": "index.js",
6
6
  "scripts": {