Open
Description
- Is this a client library issue or a product issue?
I guess a bug in the client library ("@google-cloud/datastore": "^6.3.0"
)
Environment details
- OS: Linux
- Node.js version: 14.15
- npm version: 6.14.8
@google-cloud/datastore
version: 6.3.0
Steps to reproduce
-
Create an entity in the cloud console with an integer column, named
integer_column
and set its value to 200. -
Executes a query with a filter on that column:
const query = datastore
.createQuery(tableName)
.filter('integer_column', '>', value);
const [results] = await datastore.runQuery(query);
Expected behavior:
The correct results are returned if value
is a valid numerical value, i.e. 123 or 123.456
Actual behavior
The correct results are only returned if value is 123. A float value (123.456) would return an empty result.
Workaround
Update the query to add Math.round()
.
const query = datastore
.createQuery(tableName)
.filter('integer_column', '>', Math.round(value));
const [results] = await datastore.runQuery(query);
Thanks!