diff --git a/Fauna.Test/Integration.Tests.cs b/Fauna.Test/Integration.Tests.cs index bcda8fc9..a1540687 100644 --- a/Fauna.Test/Integration.Tests.cs +++ b/Fauna.Test/Integration.Tests.cs @@ -522,4 +522,20 @@ public async Task CanResumeStreamWithStreamOptions() Assert.Zero(expectedEvents, "stream handler should process all events"); } + + [Test] + public async Task CollectionAll() + { + var query = FQL($"Collection.all()"); + object result = (await _client.QueryAsync(query)).Data!; + switch (result) + { + case Page p: + Assert.Greater(p.Data.Count, 0); + break; + default: + Assert.Fail($"Expected Page>> but was {result.GetType()}"); + break; + } + } } diff --git a/Fauna/Serialization/DynamicSerializer.cs b/Fauna/Serialization/DynamicSerializer.cs index e8061d8f..502e2889 100644 --- a/Fauna/Serialization/DynamicSerializer.cs +++ b/Fauna/Serialization/DynamicSerializer.cs @@ -85,6 +85,9 @@ private object DeserializeDocumentInternal(MappingContext context, ref Utf8Fauna builder.Doc = (Dictionary?)_dict.DeserializeDocument(context, builder.Id, builder.Name, builder.Collection, ref reader); break; } + + // After we deserialize into a doc, we end on the EndDocument a token and do not want to read again + if (reader.CurrentTokenType == TokenType.EndDocument) break; } return builder.Build();