小编Fhr*_*ldt的帖子

有没有办法从 Firestore 中的数组更新特定索引

有没有办法从 Firebase/firestore 中的数组更新特定索引?

 export const editComment = (comment) => {
 return (dispatch, getState, { getFirebase, getFirestore }) => {
    const firestore = getFirestore();

    firestore.collection('topics').doc(comment.topicId).update({

     comments:  <--- this is array of objects


    }).then(() => {
      dispatch({ type: 'EDIT_COMMENT' })
    }).catch((error) => {
      dispatch({ type: 'EDIT_COMMENT_ERROR', error})
    })
  }
}
Run Code Online (Sandbox Code Playgroud)

javascript firebase reactjs google-cloud-firestore

9
推荐指数
1
解决办法
7714
查看次数