Giter Site home page Giter Site logo

Comments (4)

micaww avatar micaww commented on May 25, 2024 1

Hey @cristyansv!

The error that you are receiving is actually coming from the google-cloud/datastore module, and not gstore-node.

You are getting this error because if you send Datastore a query that involves the use of more than one index, you must create a composite index for those two properties. Since you are only asking Datastore for only two properties, it will only get its data from those 2 indexes (instead of retrieving the whole object and removing all other properties).
Fortunately, google-cloud-node even tells you how it thinks you should structure your index!

To add this composite index, create an index.yaml file by your app.yaml file with these contents:

indexes:
  - kind: Project
    properties:
      - name: name
      - name: updateOn  

Then you can update the index by issuing this command from your shell in your project directory:

gcloud datastore create-indexes index.yaml

Where index.yaml is that file you just created.

It'll take a few minutes for the index to be created and all of your documents to be reindexed, but then you will be able to use that query no problemo!

from gstore-node.

cristyansv avatar cristyansv commented on May 25, 2024

Investigating discovered that this error happens by not having a designated Composite Index

from gstore-node.

micaww avatar micaww commented on May 25, 2024

You can also just take out the .select() part of your query and not have to define a composite index. This will also be a little bit slower because DS will return the entire item. You may not want this though, because maybe you have a lot of data.

Retrieving from the indexes alone will always be significantly faster. Especially when paging through lots of data, like yours will.

from gstore-node.

sebelga avatar sebelga commented on May 25, 2024

Thanks @micaww for the explanation. Yes indeed the error is because you need to generate the indexes for your query. You can do as micaww says or if you are using the Datastore Emulator it can generate the indexes for you.
The command is:
gcloud datastore create-indexes ~/path/to/your/local-datastore/WEB-INF/index.yaml

I will close the issue as it is not related to gstore-node.
thanks

from gstore-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.