Page 1 of 1
How to implement a contains query
Posted: Sun Jul 20, 2014 6:48 am
by daniel goshen
I am trying to place a "
contains query" in my data services query. When debugging I see that the correct value is being passed or captured, but I am not constructing the query correctly.
When I click the "add JS" button for the "where" clause, I add the following: return '{"color_number": "'+value+'"}'; I have tried various on this including return '{"color_number": {"$in":["'+value+'"]}}';but can't seem to get it to working. Any assistance would be appreciated.
How to implement a contains query
Posted: Sun Jul 20, 2014 2:37 pm
by daniel goshen
Am I going about this the correct way?. As the questions before and after mine have been I addressed - I wanted to see if I am missing/overlooking something.
How to implement a contains query
Posted: Sun Jul 20, 2014 2:46 pm
by Illya Stepanov
Hi Daniel,
Please clarify as it's not clear what you are trying to do, you saying that you see that the correct value is being passed - where do you see this?
Also please show the structure of your mapping as its not clear how you are adding "add JS" to the "where" clause.
How to implement a contains query
Posted: Sun Jul 20, 2014 7:26 pm
by daniel goshen
Hi Illya Sorry. I was not sure how much detail to provide. Let me pull a few images together.
How to implement a contains query
Posted: Mon Jul 21, 2014 1:14 am
by daniel goshen
I have created a page with the images showing what I have done lfwebz.biz/apq/mood.html
How to implement a contains query
Posted: Mon Jul 21, 2014 8:59 am
by Kateryna Grynko
Hi Daniel,
Could you please clarify whether color_number is an array of numbers or strings? If numbers, try the following:pre return '{"color_number": {"$in":['+value+']}}';/pre
How to implement a contains query
Posted: Tue Jul 22, 2014 4:06 am
by daniel goshen
Goodness, thanks so much - that got it working.