-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Problem with lessThan and greaterThan when using date fields #1456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is your Parse.com connected to the same database? I think the best way to handle this issue going forward is to come up with a failing test case that shows that this query won't return the expected data. The sample issue linked at the top of the placeholder text in your original post has an example of this. |
Is your Parse.com connected to the same database? - Yes , I migrated my database to ec2 mongo from parse , so it is using same database. |
Environment SetupRunning on local machine . I am using [email protected] , node @v4.4.2 , mongo 3.2.4. Steps to reproduceSo I made test app with a class Activity and the code that i am running.
Output of my Activity Class (used output function) when I called api.parse.com/1/output
This is the output of my lessthangreatthan function when i called api.parse.com/1/lessthangreatthan
Now I ran the code on my local parse server (http://localhost:1338/parse/functions/output)
But when i run lessthangreatthan on my local server (http://localhost:1338/parse/functions/lessthangreatthan) my response is empty |
The request.params.updatedAt parameter you're passing to the function is a String, but the query constraint for dates expects a Date. Please update your Parse Server Cloud function to use the Date constructor to create a new Date object from the string in request.params.updatedAt. The difference in behavior between hosted Parse Cloud Code could be explained by a difference in the version of the JavaScript SDK being used (see your Parse Cloud Code config to check which SDK you're loading in), or you may be running into the same issue raised in #655. |
Thanks, that fixed it. |
Check out this issue for an ideal bug report. The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!
For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.
Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!
Environment Setup
Running on local machine . I am using [email protected] , node @v4.4.2 , mongo 3.2.4.
I have my mongo db setup in ec2 .
Steps to reproduce
I ran the test on both parse.com cloud code and my local server.
This is the code that i was running
.
This is my console.log for activityQuery when i run it on parse.com
{"where":{"updatedAt":{"$gt":"2016-04-11T10:35:58.411Z"}},"limit":4,"order":"-updatedAt"}
This is my console.log for activityQuery when run on local parse server
ParseQuery { className: 'Activity',_where: { updatedAt: { '$gt': '2016-04-11T10:35:58.411Z' } },_include: [],_limit: 4,_skip: 0,_extraOptions: {}, _order: [ '-updatedAt' ] }
Logs/Trace
The text was updated successfully, but these errors were encountered: