-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Bad value in mongoObjectToParseObject when query order by Date descending #4966
Comments
Do you have a sample of the objects that don’t work? It’s possible that a single bad value may cause the error. If you have the objects as stored in the DB (right from mongo) and one after transformation, that would help. |
@flovilmart , I'm trying to find what causes the problem, I still cannot find the error objects in 80k objects data yet. It just cannot be sorted descending, only works with ascending. |
Quick question does it not work for all date fields or just that one. Like if you copied to another field could you sort? |
createdAt and updatedAt work well. It does not work with the new Date type field that the data was copied to. When I converted to Number using |
Have you tried inspect element / debugging the dashboard / server? Are your fields indexes properly 80k sounds like a lot? |
The dashboard work will with other collections. In the browser console, dashboard's requests run through except when I sort that field and http response code is 500 Internal Server Error. Both the dashboard and my mobile apps throw the same error message above. The field is not index. |
Well we know it’s coming from here You can try to set a breakpoint or console.log to see if you can find the object. |
If you find it can you post it here so we can write a test for it? A mongo object or verbose log would be appreciated. |
I logged the object at the point (actually it's at |
Oh I didn’t realize it was thrown in two places. Need to update that message. At least you are on the right track. You can follow the call stack. |
Found it
The error is thrown when |
Thanks for finding the object. Once I saw nested I knew it had to be a different field. Try setting it to an empty string and see if that works. You might have more objects and you know what to look for now. That error has been there since the beginning Parse Server 2.0 and there are no test cases for it. I don’t know what the logic was behind it. But I don’t see anything wrong with returning undefined / null. @flovilmart Thoughts? |
Thank you @dplewis for your great help. |
@andj207 no problem. Although I still have a ton of questions about the behavior you were having from this. I’ll play around with it and see if I can replicate it |
There’s no reason to crash there, If we can work around it, i’d Happily release a 2.8.5 sooner |
Issue Description &
Steps to reproduce
I use a self host ParseServer and my database currently grows more than 80k objects in a collection. I use parse-dashboard to view and manage them. The problem happens when I browse that collection sorted by "publishedDate" field descending. The error is below:
ParseError { code: 1, message: 'bad value in mongoObjectToParseObject' }
It only happens with that field ordered by descending, works well by ascending. Other fields in that collection and other collections work well too. I've checked on my mobile apps, the data cannot be loaded because of that error.
I've tried many ways to overcome the error:
(1) set all null values to a Date value;
(2) copied all that field's values to a new field and copied them back;
(3) converted that field's date values to Number and stored in other field and converted them back (using mongo language)
None of them help to solve the error. My local database work well with the same data.
Environment Setup
Server
Database
Logs/Trace
Error generating response. ParseError { code: 1, message: 'bad value in mongoObjectToParseObject'}
The text was updated successfully, but these errors were encountered: