proto.io 0.0.169 → 0.0.170
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.
|
@@ -2274,8 +2274,12 @@ const encodeFieldExpression = (compiler, parent, field, expr) => {
|
|
|
2274
2274
|
if (relation && parent.className) {
|
|
2275
2275
|
if (!_.every(expr.value, x => x instanceof index.TObject && x.objectId))
|
|
2276
2276
|
break;
|
|
2277
|
+
const tempName = `_populate_expr_$${compiler.nextIdx()}`;
|
|
2277
2278
|
const populate = _selectRelationPopulate(compiler, { className: parent.className, name: parent.name }, relation.populate, `$${field}`, false);
|
|
2278
|
-
return sql `ARRAY(
|
|
2279
|
+
return sql `ARRAY(
|
|
2280
|
+
SELECT ${{ identifier: '_id' }}
|
|
2281
|
+
FROM (${populate}) AS ${{ identifier: tempName }}
|
|
2282
|
+
) ${{ literal: op }} ARRAY[${_.map(expr.value, (x) => sql `${{ value: x.objectId }}`)}]`;
|
|
2279
2283
|
}
|
|
2280
2284
|
if (!dataType) {
|
|
2281
2285
|
return sql `jsonb_typeof(${element}) ${nullSafeEqual()} 'array' AND ${element} ${{ literal: op }} ${_encodeJsonValue(index._encodeValue(expr.value))}`;
|