I can't query GQL for 2 properties, only wildcard works

I save the object commentto the data store and use it Datastore Viewerto view the stored data.

I can fulfill the following queries

select * from comment    
select __key__ from comment
select Subject from comment
select Comment from comment

But I can not request

select Subject, Comment from comment
// Error: The suggested index for this query is:
//    - kind: comment
//      properties:
//      - name: Comment
//      - name: Subject
select __key__, Subject, Comment from comment
// Error: projections are not supported for the property: __key__

I can not find the link why this is wrong. These mistakes do not tell me much.

I have not set a single key or index for these objects.

The documentation reports the following:

SELECT [DISTINCT] [* | <property list> | __key__]
  [FROM <kind>]
  [WHERE <condition> [AND <condition> ...]]
  [ORDER BY <property> [ASC | DESC] [, <property> [ASC | DESC] ...]]
  [LIMIT [<offset>,]<count>]
  [OFFSET <offset>]

  <property list> := <property> [, <property> ...]
  <condition> := <property> {< | <= | > | >= | = | != } <value>
  <condition> := <property> IN <list>
  <condition> := ANCESTOR IS <entity or key>
  <list> := (<value> [, <value> ...]])

Subject, Comment- list of properties and valid request. But this is not so. I created an object from Go code.

+4
source share
1 answer

Design requests have some limitations. The project-doc mentions that "Only indexed properties can be projected".

, Subject, Comment . ,

- kind: comment
  properties:
  - name: Comment
  - name: Subject

index.yaml . project-doc.

// Error: projections are not supported for the property: __key__

Entity keys GetAll. .

keys, err := q.GetAll(c, &people)

, , , .

+3

All Articles