Skip to content

Max length primary keys and checkpoints #7587

@wuzzeb

Description

@wuzzeb

I am getting a max length error when writing the checkpoints to the meta instance, specifically this line in checkpoint.ts. The error is a validation error that the id exceeds the maximum length. Stepping through the code, the id is set in a call to getComposedPrimaryKeyOfDocumentData a few lines above which is setting the id to up|1 where up is the direction.

But looking at the definition of the meta instance, it is defined like so:

            id: {
                type: 'string',
                minLength: 1,
                // add +1 for the '|' and +1 for the 'isCheckpoint' flag
                maxLength: parentPrimaryKeyLength + 2
            },

But, in my own collection, I have a maximum key length of 1 (keys are only a single character),
so this is calculated to 3. But up|1 has length 4.

I see that down|1 is also a key, so the max length for the meta instance should probably be max(4, parentPrimaryKeyLength) + 2.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions