How can you query a database using server code?
How can you query a database using server code (instead of a request query string approach)?
The javascript code also needs to add wildcards to the search term. For example a query of 'bread' into a food database could return 'sourbread', 'white bread', 'bread pudding', etc
The process overview is shown below:
/// 1. User searches for something ///
User enters query into a search bar (mobiletextinput)
/// 2. Map the search query to service request ///
Mapped to the body of a service request. (as opposed to a querywhere)
/// 3. server code request to get user query ///
var query_on_server = request.object().mobiletextinput;
/// 4. set up criteria from which to interrogate database ///
params.criteria = {"coloumn_in_collection_to_be_searched" : query_on_server_with_wildcards};
/// 5. server code - Interrogate database using query ///
query(dbId, collectionName[, params][, token] ...
/// 6. server returns query results to user... ///
I am struggling on point 4 with the query_on_server_with_wildcards bit. Naively I thought this would be a generic problem but can't find an answer elsewhere on the forum.
Any help would be much appreciated.
Many thanks,
Lee