'Retrieve Cloud Firestore data

I am saving data into Google Cloud Firestore database from one application and want to read it in another application.

It looks like I am having some mismatch between two ways of working. I am saving data into database with following call:

await CrossCloudFirestore.Current.Instance.Collection("Records").AddAsync(newRecord);

Then I am having following method for getting data in another application:

public async Task<IReadOnlyCollection<T>> GetAll<T>(CancellationToken ct) where T : IDataRecord
{
  CollectionReference collection = _fireStoreDb.Collection(_collection);
  QuerySnapshot snapshot = await collection.GetSnapshotAsync(ct);
  return snapshot.Documents.Select(x => x.ConvertTo<T>()).ToList();
}

where _collection = "Records";

My Firebase database looks like this after couple of CrossCloudFirestore.Current. calls:

https://i.stack.imgur.com/HzHE1.png

After couple of investigations it looks like Document name is the problem? If I am not mistaken with custom created document name "record" GetAll method was able to get necessary data. Can somebody help to get this working and point at what I am doing wrong?

If My data on Firebase side looks like this GetAll method works fine:

https://i.stack.imgur.com/Psrcx.png



Solution 1:[1]

Problem was in one of database fields, that was set to TimeSpan on C# side. Firebase was changing this TimeSpan property into MAP with sub-properties. As I was thinking already before to change this TimeSpan into double for holding amount of seconds. After this change everything seems to be working fine!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 LG3