LokiDB icon indicating copy to clipboard operation
LokiDB copied to clipboard

LokiDb expects data to not have a meta field

Open gotenxds opened this issue 5 years ago • 0 comments

I'm submitting a...

[X] Bug report

Current behavior

Today, when inserting a new object to a collection, LokiDb adds a meta property to that object on to which it writes a version property

            if (!this._disableMeta) {
                newDoc.meta.version = 0;
            }

If the object already has a meta property and it is set to null (as per my case) then loki will try and set null.version = 0 Which causes an error

Expected behavior

Loki should not reserve properties without some kind of prefix or suffix as for example 'meta' is a common property name. but instead should maybe follow the $loki property name and be called $meta or just put the meta prop in $loki

Minimal reproduction of the problem with instructions

just create a collection and insert {meta: null}

Environment

Latest loki version

gotenxds avatar Oct 06 '20 15:10 gotenxds