Page 1 of 1
How to create a search with 5 variables?
Posted: Wed Dec 11, 2013 7:28 pm
by Ignacio Valdés
With 1 variable works perfect:
return '{"name":{"$regex":"^'+value+'", "$options":"i"}}';
But does not work when using 2 or more variables:
return '{"name":{"$regex":"^'+value+'", "$options":"i"}, "brand":{"$regex":"^'+value+'", "$options":"i"}}';
How to create a search with 5 variables?
Posted: Wed Dec 11, 2013 8:27 pm
by Maryna Brodina
Hello! Should be working... Your request means that name and brand fields should start with value of value variable. Is that request you want to send to DB?
How to create a search with 5 variables?
Posted: Thu Dec 12, 2013 2:04 am
by Ignacio Valdés
Exactly! The console displays the following:
I also add the following images:
inline.png?1386812846[/img] [/url]
Thank you very much!
How to create a search with 5 variables?
Posted: Thu Dec 12, 2013 3:17 pm
by Kateryna Grynko
Hi Ignacio,
Take a look at here please: https://getsatisfaction.com/apperyio/...
How to create a search with 5 variables?
Posted: Fri Jan 31, 2014 5:48 pm
by Ignacio Valdés
I try to do it but does not work for me 
http://cl.ly/image/3f00140f1e2F
How to create a search with 5 variables?
Posted: Fri Jan 31, 2014 7:27 pm
by Kateryna Grynko
Hi Ignacio,
This is not a valid JS code. If I understand what you want correctly, add this code for 'where' parameter: prereturn '{"brand":{"$in": ["model","age"]}}';/pre
How to create a search with 5 variables?
Posted: Mon Feb 03, 2014 5:00 pm
by Ignacio Valdés
I'm kinda lost, now it finds nothing
Thanks!
How to create a search with 5 variables?
Posted: Mon Feb 03, 2014 10:44 pm
by Maryna Brodina
Hello! With query you posted you want to get all records where in brand field either model or age. As we ca see from this screenshot https://d2r1vs3d9006ap.cloudfront.net... this is not what you need. Could you describe what you map to where parameter and what you expect to get?
How to create a search with 5 variables?
Posted: Tue Feb 04, 2014 4:31 pm
by Ignacio Valdés
I want to perform a compound search, so that the user can enter:
name of a car brand + car name + year of the car
The search result should be the price data of that car and specifications.
I hope I have explained correctly.
Thanks!
How to create a search with 5 variables?
Posted: Tue Feb 04, 2014 9:54 pm
by Maryna Brodina
Hello! Do you need user enter all search parameters in one Input (for example Volvo XC90 2004) or you have 3 Inputs for each value (please note it's better solution)? How do you want to implement this?