我有2个数组,比如
phonenumber[]={12345,67890,43215,34567,56789}
amount[]={10,20,30}
我想将数据存储在像
这样的文档中再次在firestore中的同一文档中发生相同的过程。 是否可以在firestore中存储这样的
我的代码
final int phonenumber[] = {12345,67890,43215,67894,32453};
final int length = list.length;
final int amount[] = {20,30,40,50,60};
final int length1 = amount.length;
Map<String, Object> docData1 = new HashMap<>();
for(int i =0 ; i<length;i++)
{
for(int j =i;j<=i;j++){
docData1.put("phonenumber", list[i]);
docData1.put("amount", amount[i]);
}
}
docData1.put("invitee",docData1);
db.collection("Split").document("lahari")
.set(docData1)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "DocumentSnapshot successfully written!");
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w(TAG, "Error writing document",e);
}
});
我遇到的错误是