Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Array operations #3

@gormster

Description

@gormster

Pretty quickly realised that setProperty doesn't work to add new values to an array (you get, predictably, an "Index out of range" fatal error). So, we need append(_:forKey:) to add new values to the end of an array, and remove(at:forKey:) to remove & renumber the remaining elements. This should be executed using $push and $pop ideally, but if keys have both been added and removed then it may be necessary to use $set (I don't think there's a way to reorder an array in a single DB call).

I think possibly it might be better for the mutatedFields document to be the actual update document and just keep track of sets, unsets, pushes and pops as the Instance itself is mutated. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions