LiteDB: Error "Invalid format: Collection" when doing Upsert

I am trying to do an “Collection.Upsert” on the following POCO class. [There are other classes like this where upsert works fine!. Only this class fails]. The error is: Error “Invalid format: Collection” when doing Upsert


public class Order : BindableBase { public Order() { this.OrderItems = new List<string>(); } public int Id { get; set; } [BsonRef(“OrderMaster”)] public OrderMaster OrderMaster { get; set; } public List<string> OrderItems { get; set; } }


Stack trace:

Invalid format: Collection at LiteDB.CollectionService.Add (System.String name) [0x0002b] in <b99fd1821def4ff9a5794b6636ed75ad>:0 at LiteDB.LiteEngine.GetCollectionPage (System.String name, System.Boolean addIfNotExits) [0x00035] in <b99fd1821def4ff9a5794b6636ed75ad>:0 at LiteDB.LiteEngine.Transaction[T] (System.String collection, System.Boolean addIfNotExists, System.Func`2[T,TResult] action) [0x00006] in <b99fd1821def4ff9a5794b6636ed75ad>:0

Thank you for the help…

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

It would be nice with more explicit error messages than just “Invalid format”. For example “Name too long” and “Invalid character in name” and …

Upgrade do 4.1, it´s fixed now in 60 chars (at limit of 3000 for all collections names)

Hi @vanufryiuk, soon… maybe this week 😃 I’m will release v4.0.1 before v4.1 that I’m working in another branch.

I have the same problem and I think I know where the problem lies. If a collection name exceeds 30 positions, it fails!

Could you please increase the limit of the name, or at least generate some kind of error…