Skip to content

Getting multiple entities with just one results in crash #7

@oander11

Description

@oander11

Using the following cache:

const cache = new NsqlCache({
    db: dsAdapter(datastore),
    stores: [
    {
        store: redisStore,
        host: REDISHOST, 
        port: REDISPORT
    }],
});

and then fetching two entities works fine:

const keys = [
  datastore.key(['Company', 123]),
  datastore.key(['Product', 'Computer'])
];

datastore.get(keys, (err, entities) => {});

But if you use an array but just have one item inside it:

const keys = [
  datastore.key(['Company', 123])
];

you get the following exception:

TypeError: Cannot read property 'join' of undefined
    at keyToString (/x/node_modules/nsql-cache-datastore/lib/index.js:99:29)
    at Object._db.keyToString.key [as keyToString] (/x/node_modules/nsql-cache/lib/index.js:171:61)
    at keyToString (/x/node_modules/nsql-cache/lib/keys.js:17:60)
    at Object.read (/x/node_modules/nsql-cache/lib/keys.js:68:65)
    at Datastore.ds.get (/x/node_modules/nsql-cache-datastore/lib/index.js:184:35)
    at require.ProviderController.get (x/src/js/controllers/providerController.js:47:31)
    at Layer.handle [as handle_request] (/x/node_modules/express/lib/router/layer.js:95:5)
    at next (/x/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/x/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/x/node_modules/express/lib/router/layer.js:95:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions