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

Categories

What would be the right way to query a field that is an array of maps.

Currently the structure is

Collection1
     Document1
         -papers:                <---- This is an array  
              (0): 
                 -Name:abc
                 -Id:123 
              (1): 
                 -Name:xyz
                 -Id:456

And this is my code

DocumentReference docRef = db.collection("Collection1").document("Document1");
        docRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
            @Override
            public void onComplete(@NonNull Task<DocumentSnapshot> task) {
                if (task.isSuccessful()) {
                    DocumentSnapshot document = task.getResult();
                    if (document != null && document.exists()) {
                       //?? how can I retrieve papers
                }
            }
        });

Basically do I retrieve it and cast it as an ArrayList> and then loop through it to create my final ArrayList ?

Or how does it work ?

See Question&Answers more detail:os

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

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...