Joe Taras
Joe Taras

Reputation: 15379

OrientDB use LIKE in an encapsulated field

I have an OrientDB table named CalculationFunctionGroup, in which I have a field named functions.

This field has JSON content like this:

[{"@type":"d","@version":0,"@class":"CalculationFunction","name":"AR_0015_0280","code":"//AR_0015_0280 OTTIMIZZATA / FORMATTATA\nvar worka01 = anagPay(\"AR_0015_0280\", -1);\nreturn worka01;","language":"Javascript"}]

I want to extract rows satisfying a LIKE condition on the code element of the JSON.

I've tried this query:

SELECT FROM CalculationFunctionGroup
WHERE functions.code LIKE '%OTTIMIZZATA%'

But the number of extracted rows is ZERO!

Upvotes: 1

Views: 114

Answers (1)

Michela Bonizzi
Michela Bonizzi

Reputation: 2632

Try this:

select expand(distinct(rid))
from (select @rid,functions.code
      from CalculationFunctionGroup unwind functions)
where functions like "%OTTIMIZZATA%"

Upvotes: 0

Related Questions