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.
- package/db/entity.js +3 -1
- 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
|
|
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 {
|