parse-server: Bad value in mongoObjectToParseObject when query order by Date descending

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)

object.time = object.publishedDate.getTime(); 

object.publishedDate = new ISODate(object.time); // this works but the value is wrong (for example Jan 31, 9998 while expected is Sep 3, 2001) or

object.publishedDate = new ISODate(new Date(object.time).toISOString()) //or

object.publishedDate = new Date(object.time);

None of them help to solve the error. My local database work well with the same data.

Environment Setup

  • Server

    • parse-server version: 2.8.1
    • Operating System: Ubuntu 16.04
    • Hardware: 1GB Ram, 25GB Disk space.
    • Localhost or remote server?: Digital Ocean
  • Database

    • MongoDB version: 3.0.8
    • Storage engine: MongoRocks
    • Hardware: 1GB Ram, 25GB Disk space.
    • Localhost or remote server?: Digital Ocean

Logs/Trace

Error generating response. ParseError { code: 1, message: ‘bad value in mongoObjectToParseObject’}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

@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