Description
New Issue Checklist
- [ x] I am not disclosing a vulnerability.
- [ x] I am not just asking a question.
- [ x] I have searched through existing issues.
- [ x] I can reproduce the issue with the latest version of Parse Server.
Issue Description
Saving an undefined value into an existing ParseObject field, creates a null pointer in the mongoDb Atlas document.
For Example:
I have a ParseObject "Form" with a field "student" which is a _User object.
When I set "undefined" into the student field and then save the Form object it creates a null pointer field which is not detectable through the parse-server but appears as null in mongoDB as such -> _p_student null
The moment this pointer is created with null value, it is impossible to use doesNotExist and exists in a query because it believes the object exists. While in the parse dashboard it appears as undefined, but acts as an existing object when working with exists & doesNotExist in a query.
Steps to reproduce
Easy, just save an undefined value into an object field of an existing ParseObject and save the object. It will seem as if the value is undefined, but don't be fooled. the dashboard even will show you that it's undefined and when using .get('student') it witll be undefined in code. BUT, when you want to do "exists" in a query it will assume it exists, because when going to mongodb atlas you will find a _p_field_name : null and thus disrupting the exists/doesNotExists functionality in a query.
Actual Outcome
var formQuery = new Parse.Query('Form');
formQuery.doesNotExist('student');
formQuery.find({ useMasterKey: true })
.then(function (formObjects) {
//The object where I've inserted an undefined value into student will not return in this query
})
Expected Outcome
var formQuery = new Parse.Query('Form');
formQuery.doesNotExist('student');
formQuery.find({ useMasterKey: true })
.then(function (formObjects) {
//Having the object which I saved undefined into student should still appear here
})
Environment
NodeJs
Server
- Parse Server version: 6.2.0
- Operating system: NodeJs
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Heroku
Database
- System (MongoDB or Postgres): MongoDB
- Database version: 6.0
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript
- SDK version: 6.2.0
"parse": "4.0.1",
"parse-server": "^6.2.0",