Google Cloud datastore, no matching index found for a simple one field ordering. I'm running locally and can generally crud the database ok.
according to the Query documentation, seems simple enough. I've even tried creating manual indexs in the GC datastore console.
I'm trying to order by a single integer field.
const query = dataStore.createQuery('myRecords')
query.order('anyField')
dataStore.runQuery(query)
I expect to get a list of results in order, but get this error (below). Without the query.order(), I get results ok, but disordered.
{ Error: no matching index found.
at Http2CallStream.call.on (C:\Users\...\node_modules\@grpc\grpc-js\build\src\client.js:101:45)
at Http2CallStream.emit (events.js:203:15)
at process.nextTick (C:\Users\...\node_modules\@grpc\grpc-js\build\src\call-stream.js:71:22)
at process._tickCallback (internal/process/next_tick.js:61:11)
code: 9,
details: 'no matching index found.',
metadata: Metadata { options: undefined, internalRepr: Map {} },
note:
'Exception occurred in retry method that was not classified as transient' }
EDIT: I've conceded that google datastore is too complicated for me, and got it working from scratch with cloud mongo in less time than I've spent trying to resolve something that shouldn't be this difficult.
thanks to those who commented.