Page 1 of 1

query between dates in the javascript option of the where statement

Posted: Sun Jul 14, 2013 6:53 am
by Tommy B

I want to query the back-end appery db for records that are equal to and in-between two dates. I will have a start date and an end date set. I tried this and versions similar in js of the "where" statement. No luck!

codereturn '{"date":"'>=dateStart && <=dateEnd'"}';/code


query between dates in the javascript option of the where statement

Posted: Sun Jul 14, 2013 7:04 am
by Igor

Hello,

You should use "$lt" and "$gt".
This should help:
http://docs.appery.io/documentation/b...
http://cookbook.mongodb.org/patterns/...


query between dates in the javascript option of the where statement

Posted: Mon Jul 15, 2013 11:28 pm
by Tommy B

Thanks I will have to keep these in my shortcuts it is good info.

One other related question, when defining the "Where JS" does that have to be specifically bound to a component or can i reference a field codevar field = Appery ('field')&#46;val()/code


query between dates in the javascript option of the where statement

Posted: Mon Jul 15, 2013 11:46 pm
by Igor

First of all you should use component name.
Appery.io JavaScript API: http://docs.appery.io/javascript-api/


query between dates in the javascript option of the where statement

Posted: Wed Jul 17, 2013 2:20 am
by Tommy B

Ok, so I can figure out how to do this.

I have multiple dates stored in a field in the appery db. The field is in string format. What i need to do is query between two dates that are stored in that field within the service that is created against the database.


query between dates in the javascript option of the where statement

Posted: Wed Jul 17, 2013 6:28 am
by Maryna Brodina

Hello! Field with data should have not string type, but date. This should help https://getsatisfaction.com/apperyio/...