Comments (4)
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.
Investigating discovered that this error happens by not having a designated Composite Index
from gstore-node.
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.
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)
- query filter on nested property value. HOT 5
- tsc error: Could not find a declaration file for module 'nsql-cache' HOT 3
- could not get data filter by entity key
- Support for @google-cloud/datastore version 5 HOT 2
- Support for custom validators (AJV)
- bulk insert? HOT 2
- Cannot read property 'Symbol(KEY)' when body is null or undefined HOT 1
- Typescript Compile Error HOT 2
- Support for HABTM
- Could not find gstore instance with id "${id}" HOT 2
- How to validate a value agains another property? HOT 1
- Datastore Key type error when using cache HOT 7
- Update method doesn't clear cache HOT 6
- Add Transaction support to `findOne` option HOT 1
- Support filtering for a missing optional property. HOT 1
- New query operators HOT 1
- @google-cloud/datastore version 7 support HOT 1
- could not get data filter by entity key HOT 1
- Migrate Travis CI builds to Circle CI
- Gstore node 7.2.8 TypeError: OptionalDataloader is not a constructor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gstore-node.