Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

The schema-less API cannot read a typed collection that holds a document larger than one page: FindAllAsync and BLiteMigration throw "Skipping type 69"

Open
#301 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@CaffeinatedCoder is already working on this.

Since Oct 18, 2026.

  • #319 by @CaffeinatedCoder — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
databases

Research direction

Start with src/BLite.Core/DynamicCollection.cs, especially ValidateWrite and the scan/lookup paths, and compare overflow handling with src/BLite.Core/Collections/DocumentCollection.cs; also inspect src/BLite.Bson/BsonSpanReader.cs. Review src/BLite.Core/BLiteMigration.cs to understand how the schema-less read and write paths affect migrations, including cleanup on failure. Use the store-model tests described in the issue for documents larger than a page and add a migration round-trip test; success means large typed documents are readable and migratable, or the documented limitation and preflight failure behavior are implemented.

Written by the indexing model from the issue text.

Description

bug package/core severity/medium

A typed collection stores a document larger than one page (about 16 KB with the default 16 KB pages) in overflow pages. The schema-less API cannot read such a collection: DynamicCollection.FindAllAsync throws NotSupportedException: Skipping type 69 not supported at position 7 when it reaches the document. Everything built on that API fails the same way, including BLiteMigration.ToMultiFileAsync / ToSingleFileAsync, so a database with one large typed document cannot be migrated between layouts. DynamicCollection also refuses to write such a document ("Document size … exceeds maximum single page size. Overflow not yet supported in DynamicCollection."), which neither the README nor the docs mention.

Found while checking the secure-erase behaviour for #299.

Repro

public class Person { public ObjectId Id { get; set; } public string Name { get; set; } = ""; }
public partial class OvfDbContext : DocumentDbContext
{
    public DocumentCollection<ObjectId, Person> People { get; set; } = null!;
    public OvfDbContext(string path) : base(path) { }
}

await using (var db = new OvfDbContext("app.db"))
{
    await db.People.InsertAsync(new Person { Name = "small" });
    await db.People.InsertAsync(new Person { Name = new string('x', 40_000) });   // overflow pages
    await db.SaveChangesAsync();
}

// 1. The same file through the schema-less API
using (var engine = new BLiteEngine("app.db"))
    await foreach (var d in engine.GetOrCreateCollection("persons").FindAllAsync()) { }
// NotSupportedException: Skipping type 69 not supported at position 7

// 2. Layout migration
await BLiteMigration.ToMultiFileAsync("app.db", PageFileConfig.Server("app.db"));
// NotSupportedException: Skipping type 69 not supported at position 7

After the failed migration the source is intact: the typed context still reads both documents, including the 40,000-character name. The migration does leave the empty multi-file layout next to the source (app.idx, 1 MB; wal/app.wal; collections/app/).

Expected: the schema-less API reads every document the typed API wrote, and BLiteMigration copies them; or, if DynamicCollection deliberately has no overflow support, the limit is documented and the migration says which document it cannot copy before it starts.

Actual: an exception from the BSON reader with a byte position and a type code, at the first large document.

Where in the code (0450b97)

  • DynamicCollection has no overflow handling on the read path. A slot flagged SlotFlags.HasOverflow holds a 4-byte length and a 4-byte next-page id before the document bytes (written by DocumentCollection at src/BLite.Core/Collections/DocumentCollection.cs:2204-2205; DynamicCollection.cs never checks HasOverflow). DynamicCollection hands the slot bytes to BsonSpanReader as if they were a document, so the reader meets a byte that is not a BSON type (src/BLite.Bson/BsonSpanReader.cs:484).
  • Writes are refused by size: ValidateWrite (src/BLite.Core/DynamicCollection.cs:2233-2235), with _maxDocumentSizeForSinglePage = PageSize - 128 (DynamicCollection.cs:120); TimeSeries collections are exempt from the check.
  • BLiteMigration copies every collection through the schema-less API: source.GetOrCreateCollection(collName) and targetColl.InsertBulkAsync(batch) (src/BLite.Core/BLiteMigration.cs:225-261), so it fails on the read side first and would fail on the write side next.
  • BLite Studio opens a collection with engine.GetOrCreateCollection(name) (tools/BLite.Studio/ViewModels/Explorer/CollectionDetailViewModel.cs:28), and BLQL runs on DynamicCollection, so both are affected the same way (inferred from the code, not run).

Fix considerations

  • Read side first: follow the overflow chain in DynamicCollection's scan and lookup paths, as DocumentCollection does. That alone makes Studio, BLQL and the source side of BLiteMigration work on these databases.
  • Write side: overflow on insert and update in DynamicCollection, or a documented limit. The migration needs one of the two, since its target is also a DynamicCollection. The LiteDB import of #297 writes to DynamicCollection too, and LiteDB documents can be much larger than a page.
  • BLiteMigration: clean up the target's sub-files on failure, not only the .migrating temp file.
  • Tests: the store model of #250 with document sizes past one page, read back through both APIs; a migration round trip with a large document.

Related: #297 (LiteDB import writes to DynamicCollection), #296 (stability matrix: what the schema-less API supports), #299 (found while checking it).

Dominant language
C#
Stars
66
Forks
6
Avg merge
1d 2h
Merged PRs (30d)
58

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EntglDb/BLite

All issues in EntglDb/BLite

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.