question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field has an invalid name on upgrading 1.0.5 to 2.0.4

See original GitHub issue

I’m attempting to upgrade a database from 1.0.5 to 2.0.4 but the upgrade fails.

It doesn’t appear to like spaces in field names?

.\LiteDB.2.0.4\tools\LiteDB.Shell.exe .\database.db --upgrade .\database_v2.db --exit
Welcome to LiteDB Shell

Getting started with `help`

> open .\database.db
open "database.db" (v1.0.4)
> dump > C:\Users\Tim\AppData\Local\Temp\tmp73D3.tmp
> open .\database_v2.db
open "database_v2.db" (v2.0.4)
> dump < C:\Users\Tim\AppData\Local\Temp\tmp73D3.tmp
Field 'Transparent Dark' has an invalid name.
>

The upgraded database ends up with no entries in the problem collection.

Opening the old database it seems happy to dump it and I can even query the collection from the shell without upgrading.

I can’t post the exact content publically, but this gives an example of a collection entry that’s a problem on upgrade. There’s more content in each element in reality.

{
    "_id": {"$oid": "57fe86100dc86c3324b1a7c1"},
    "Name": "A Name",
    "Description": "Description",
    "Themes":
    {
        "Dark":
        {
            "Name": "Dark"
        },
        "Light":
        {
            "Name": "Light"
        },
        "Transparent Dark":
        {
            "Name": "Transparent Dark"
        }
   }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mbdavidcommented, Jan 5, 2017

Hi guys, it’s a “simple” bug in this convertion. The problem is when 1.0.4 serialize your Dictionary there is validation in key (support any string). But, when you try deserialize in 2.x BsonDocument key must be validate from here:

https://github.com/mbdavid/LiteDB/blob/master/LiteDB/Document/BsonDocument.cs#L51

v3 has no upgrade from v1 yet, but it’s on my plans.

For now, change this method to returns always true.

0reactions
DeanVanGreunencommented, Jan 5, 2017

@todo xX-MLG-Xx extend upgrade command for shell and litedb engine

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Field 'ExampleName$0$' has an invalid name" after ...
After upgrading to LiteDB 4.0 my field names are not valid anymore. The reason for this is a change in commit 0c69c84. From...
Read more >
Resolve invalid field name errors - Looker Studio Help
Solution. To resolve this issue, rename the fields from the underlying dataset and then reconnect the data source.
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Invalid token (not "=")" status:RESOLVED resolution:FIXED severity:major ... Bug:3742 - "Update the server name in the mirroring docs" status:RESOLVED ...
Read more >
Bug listing with status RESOLVED with resolution INVALID as ...
Bug:27 - "Test" status:RESOLVED resolution:INVALID severity:normal ... Bug:16784 - "ebuild has wrong name for pkg-config" status:RESOLVED resolution:INVALID ...
Read more >
Bug Looker studio Invalid field names Error
Knowing I have noticed that my date has been autmatically replace with suffix (Date). To conclude for me it's clear it's a bug...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found