How would one go about the above, using the collection, with the minimal amount of network work?
Would this be best as a server side script, with a return ? If so, would I add the script and call it as a function ?
How would one go about the above, using the collection, with the minimal amount of network work?
Would this be best as a server side script, with a return ? If so, would I add the script and call it as a function ?
Hi Addy,
Create a service that checks if this record exists.
is that using a $exists on a where clause, as it needs to check 3 col's, and then run create, or update depending on the outcome ? What does exist come back with, true/false ?
Where would I put the $exists in here ?
'{"$and" : [{"statement_id" : "'+getVar("statementID")+'"}, {"user_id" : "'+getVar("user_id")+'"}]}'; ????
I have this code:
precode
return '{"$and" : [{"statement_id" : "'+getVar("statementID")+'"}, {"user_id" : "'+getVar("user_id")+'"}]}, {"_id" : {"$exists" : false}}';
/code/pre
I get no errors, but i don't get an answer either. Just no properties.
Ideas please !!
Addy,
Add this code to the parameter 'where':prereturn '{"$and" : [{"statement_id" : "'+localStorage.getItem("statementID")+'"}, {"user_id" : "'+localStorage.getItem("user_id")+'"}]}';/preWhere 'statementID' and 'user_id' are in localStorage.
To check result (true/false) run this code on Success event:prevar result = (data.length 0) ;/pre
Hello Katya, I cant seem to get this code to work for three variables. This is the code I am trying to implement:
return '{"$and":[{"From":{"$regex":"' + Appery("from_input").val() + '", "$options":"i"}},{"Type":{"$regex":"' +localStorage.getItem("type") + '", "$options":"i"}},{"To":{"$regex":"' + Appery("to_input").val() + '", "$options":"i"}} ]}';
any suggestions
Hello,
Could you specify what exactly doesn't work.
Could you also show us network request/response screenshots from browser network tab.
http://docs.appery.io/documentation/d...
I have two input variables "from" and 'to" and I also have a nav bar with three item "bus, flight, taxi. This selects the type of transport required.
I have set the localstorage variable "type" to store what ever value the user selects from the navbar. Now I want the search to return all record matching "from", "to" and "type"
The results I am receiving are only matching "from" and "to" seems to completely ignore the type in local storage variable and will return results without regards to the type