Skip to content

Setting property to nil doesn't save to database #264

Closed
@Vortec4800

Description

@Vortec4800

New Issue Checklist

Issue Description

Setting a value on an optional model property doesn't propagate to the server.

Steps to reproduce

struct TestObject: ParseObject {
	// ParseObject Conformance
	var objectId: String?
	var createdAt: Date?
	var updatedAt: Date?
	var ACL: ParseACL?

	var testValue: String?
}

var testObj = TestObject()
testObj.testValue = "value"

testObj = try! testObj.save()
// Break here and check value on dashboard

testObj.testValue = nil

testObj = try! testObj.save()
// Break here and check value again on dashboard, see that it still says "value" and not (undefined)

Expected Outcome

Final value on dashboard should be (undefined) or nil, instead of keeping the old value.

Environment

Client

  • Parse Swift SDK version: 2.0.2
  • Xcode version: 13.0
  • Operating system (iOS, macOS, watchOS, etc.): macOS
  • Operating system version: 11.6

Server

  • Parse Server version: 4.10.4
  • Operating system: Ubuntu
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Digital Ocean

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Digital Ocean

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions