🔥🔘 Firestore do not merge specific map field #5081
Unanswered
francisleigh
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a feeling this could be the wrong place to post this question.
I have made a stack overflow post here but I just thought i'd put the feelers out :-)
I'm happy to remove if this is not the correct place!
I have a
PUT: /usersendpoint which takes multiple fields.In most cases I want to just call
.seton the document with{merge: true}to be able to update individual document-fields without removing others. but in another case I was to update a map to only have one value within it.for example:
displayName&ageare fine to be merged but when it comes togender&orientationi want to flat-out replace the map with a new one. i know I could have a property ofgender: 'male'but this doesn't allow for scalable querying as I am building a dating app and need to have an as flexible as possible query-base.At the moment say I was to call
...doc.set({ gender: {female: true} }, {merge: true});My document structure would look like:
But ideally it would just fully replace the
gendermap altogether. i.eHas anyone any experience with this? Again I want to keep this structure as a Map so that I can run queries like
I am also aware of the
arraystructure but firestore-queries are limited to 1 array query per query.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions