Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
689 views
in Technique[技术] by (71.8m points)

android - How to update elements in arrays of maps in Firestore?

I have and Android App (java) that accesses firestore documents that comprise of an array field as shown:

{
  cards: 
    [
      {
        reference: "",
        response: {
                    text: "",
                    title: "",
                  },
        timestamp: ""
      },

      {
        reference: "",
        response: {
                    text: "",
                    title: "",
                  },
        timestamp: ""
      },

     .... and so on

I would like to update specific fields of each array element, like "response" : "text" and "response" : "title". What is the best way to achieve this?

I have read in several places that arrays cannot be updated at element level and that I may have to completely overwrite the entire array. Is that true? Is so, how can I construct my update statement in Android (Java) for the same?

Thanks,

AB

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...