Tell me how to create a multi-level database structure using firebase Cloud Firestore, which will include registered user IDs and data that relate to each user. The idea is that each user can save any information, in my case it is a movie as an object with some data. The code below works, but the problem is that every time a new document is added as an object, the previous document is replaced with a new one, but I need an array of the type of objects
async addToFavorList({commit, getters}, payload) { try { await firebase.firestore().collection('users').doc(getters.uid).set({ id: payload.id, poster_path: payload.poster_path, title: payload.title, release_date: payload.release_date, vote_average: payload.vote_average }); } catch(error) { console.log(error.message); } } The desired result is obtained in this way:
async addToFavorList({commit}, payload) { try { await firebase.firestore().collection('movies').add({ id: payload.id, poster_path: payload.poster_path, title: payload.title, release_date: payload.release_date, vote_average: payload.vote_average }); } catch(error) { console.log(error.message); } } But the problem is that in the last version I do not have a binding to a specific uid. Those. any registered user receives data that another user has added with another uid