You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 31, 2022. It is now read-only.
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?
The text was updated successfully, but these errors were encountered:
Ah.. good one! I've honestly never mutated an array with Mainecoon. I was planning on making it the update document, but since I'm a bit loaded with work I didn't have the time to do this yet.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 needappend(_:forKey:)
to add new values to the end of an array, andremove(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?
The text was updated successfully, but these errors were encountered: