Skip to content
This repository was archived by the owner on Oct 27, 2022. It is now read-only.
This repository was archived by the owner on Oct 27, 2022. It is now read-only.

cloud-nodejs user query uses a two-argument filter() #69

@dbs

Description

@dbs

To implement the Display a user's books query, the getUserBooks() function is updated to include the following line:

var query = dataset.createQuery(['Book']).filter('userId =', userId);

The filter() method is called with only two arguments. The result is that the user's books are never shown; the query always returns null results.

Per the docs at https://cloud.google.com/datastore/docs/concepts/queries#filters, filter() should be called with three arguments: a property, comparison operator, and value.

The correct, working code is:

var query = dataset.createQuery(['Book']).filter('userId', '=', userId);

I'll create a pull request for the code samples. Unfortunately it's not clear where the text in the codelab is supposed to be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions