-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
need/triageNeeds initial labeling and prioritizationNeeds initial labeling and prioritization
Description
The Namespace Datastore will throw an error if query is called when the parent datastore has other values in it that aren't prefixed the same.
The following code will produce this issue.
import { NamespaceDatastore, MemoryDatastore } from 'datastore-core'
import { Key } from 'interface-datastore'
const root = new MemoryDatastore();
const sub1 = new NamespaceDatastore(root, new Key('sub1'))
const sub2 = new NamespaceDatastore(root, new Key('sub2'))
sub1.put(new Key('test'), new Uint8Array([123]))
for await (const pair of sub2.query({})) { }
Creating the following error:
throw new Error(`Expected prefix: (${prefix.toString()}) in key: ${key.toString()}`)
^
Error: Expected prefix: (/sub2) in key: /sub1/test
The expected behavior is for the query to only run on namespaced keys.
Versions:
"datastore-core": "^9.2.0"
"interface-datastore": "^8.2.3"
Metadata
Metadata
Assignees
Labels
need/triageNeeds initial labeling and prioritizationNeeds initial labeling and prioritization