squidfunk / isotopes

Serverless and typed object store built on top of AWS SimpleDB

Home Page:https://squidfunk.github.io/isotopes/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect documentation for query a domain

sawilde opened this issue · comments

Description

In the docs for Isotope the example for a query is

const expr = tasks.getQueryBuilder()
  .where("`active` = ?", true)
  .order("`props.memory >= ?`", 2048)
  .limit(100)

This is incorrect as you do not order by a predicate.

Expected behavior

it should possibly be

const expr = tasks.getQueryBuilder()
  .where("`active` = ?", true)
  .order("`props.memory`", 'asc')
  .limit(100)

however, when you try the above you will get an error like this

INFO InvalidSortExpression: Invalid sort expression. The sort attribute must be present in at least one of the predicates, and the predicate cannot contain the is null operator.

to make it work you need to add another predicate eg

const expr = tasks.getQueryBuilder()
  .where("`active` = ? and `props.memory` > ? ", true, 0)
  .order("`props.memory`", 'asc')
  .limit(100)

PS. thanks for the library - I moved from DynamoDB implementation to SimpleDB one in a few hours.

PPS. What tools do you use to manage SimpleDB if you don't mind me asking?

Thanks for reporting. Fixed in d5c1d4c. Sorry that this took so long!

Thanks for the library - I moved from DynamoDB implementation to SimpleDB one in a few hours.

That's great to hear. SimpleDB is much easier to use and has fewer constraints than DynamoDB.

What tools do you use to manage SimpleDB if you don't mind me asking?

I'm managing domains with Terraform, but if your question is what client I'm using than the answer is this one – I don't think there's any MySQLesque client that supports SimpleDB.

ezoic increase your site revenue