배열이 포함 된 Firestore 문서를 가져 오려고하는데 배열을 추가하자마자 DocumentSnapshot.toObject
메서드를 제대로 작동시키지 못합니다. 배열에 최대 1-2 개의 항목까지만 포함 할 수 있으므로 컬렉션을 사용하고 싶지 않습니다.배열을 포함하는 Firestore 문서를 비 직렬화하는 권장 방법은 무엇입니까?
java.lang.RuntimeException: Could not deserialize object. Failed to convert value of type com.google.android.gms.internal.zzegf to DocumentReference (found in field 'references.[0]')
다음은
data class SomeModel(
var references : ArrayList<DocumentReference> = ArrayList(0),
var title : String? = null,
var acronym : String? = null,
var number : Long? = null
){
}
내 경우 FireStore 문서를 하나 DocumentReference
으로 references
라는 이름의 배열을 포함 내 모델 클래스입니다. 모델 클래스에서 참조 필드를 제거하면 객체가 비 직렬화됩니다.
오른쪽이지만 문자열 목록 대신 다른 문서에 대한 Firebase DocumentReferences의 배열입니다. List 및 emptyList를 사용해 보겠습니다. –
John