79158208

Date: 2024-11-05 08:33:35
Score: 0.5
Natty:
Report link

I came accross a similar problem my data set was an array of objects called offers, inside which another array called metaData was present.

data Set Example :

offers : [{
Country : 1,
Status:1,
OfferCode :"TEST",
EndUtc : 1234455,
metaData :[{name : "isNewUSer",message :"yes"},
{name : "cohort",message :"bro please"}]
}]

I wanted to fetch all the offers whose metaData had isNewUSer atleast once. Here is the sample query for this requirement.

    for o in offers 
let a = o.metaData 
let c = (for m in a filter m.name == 'IsNewUser' return a)
filter LENGTH(c) > 0 and o.Country == "14" and o.Status ==1
return o.OfferCode

This will return all the offercodes which has isnewuser in its metaData. Thanks.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: anjan obalesh