ttu/json-flatfile-datastore

Provided inserting object `Id` type is `string` -> `Id` is still autogenerated

skorunka opened this issue · 3 comments

When the inserting object Id type is string and value is for example valid GUID, the engine still auto-generates the Id and ignore the provided value.

ttu commented

Thanks for the issue!

I suppose you mean when inserting an item to an empty collection? Then it will just get a default id and won't use the one of the inserted item. DocumentCollection.cs#L374

Will make a fix for that, so if the first item has an id it will be used.

Hi, sorry for my bad writing, was kinda tired... yes, exactly. When inserting a new entity into a collection, the provided Id is ignored and a new one is generated based on the last item's Id. I had to change a keyProperty like new DataStore("_data/db.json", keyProperty: "_id") to fix this issue. Thank you.

Good job. Thank you for hard work.