References in arrays and non-existent are lost when updating any field in a document
See original GitHub issueThanks for making Vuefire, it’s great!
I have a bound object that has an array of references as one of the fields:
For existing references in the array everything works well, however thing break when I add a new entry into that array with
firestore.collection("logs").doc(this.log.id)
.update({
photos:
firebase.firestore.FieldValue.arrayUnion(doc.ref)
});
});
I end up with the right data inside firestore, but in Vue, the new entry in the array is loaded as a string instead of an Object:
If I re-bind the object, everything is fine.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:12 (3 by maintainers)
Top Results From Across the Web
MongoDB $set item in array which does not exists with object ...
This is working in mongodb version v4.0.9. I have tested your usecase in my machine. db.collection.update( { "_id": ...
Read more >db.collection.update() — MongoDB Manual
Modifies an existing document or documents in a collection. The method can modify specific fields of an existing document or documents or replace...
Read more >Array Functions | Couchbase Docs
A new array, concatenated from the input arrays. If any of the input expr arguments or one of the array elements are MISSING...
Read more >Adding data | Firestore - Google Cloud
This guide explains how to use the set, add, or update individual documents in Firestore. If you want to write data in bulk,...
Read more >Add data to Cloud Firestore - Firebase - Google
Set a document. Data types; Custom objects. Add a document; Update a document. Server Timestamp; Update fields in nested objects; Update elements in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found the problem and a solution. I need to refactor some of the code and write unit tests before releasing a new version. I will probably be able to in a week or so 🙂
https://github.com/vuejs/vuefire/blob/a1c45de6dd7c15577c01edadb70968da9f4e835f/packages/%40posva/vuefire-core/src/firestore/index.ts#L147-L152
I rewrite this code to
It works for me.