App Engine datastore get number of childs from multiple parents
I'm using the datastore of the Google App Engine (DataNucleus). I have two classes, one Chat and one Rating. A chat can be rated more then ones so I created an one-many relationship by adding a list to the Chat class. 

Now I want to know the number of unrated chats, so I did the following:

    int numberOfChatsInStock = 0;
    for(Chat chat : chats){
      if(chat.getRatings().size() == 0){
        numberOfChatsInStock++;
      }
    }

It simply iterate through all chats and checks if the number of ratings is 0.

This solution works well when there are 10 chats, but when I have 500+ chats then the speed is terrible (15 sec +).

I thought maybe the size() method is faster. So I tried Query.setFilter("ratings.size() == 0") but this gives me the following error:
Unsupported method <size> while parsing expression: InvokeExpression{[PrimaryExpression{ratings}].size(<none>)}

Is there any way to increase the speed?

App Engine datastore get number of childs from multiple parents
===

I'm using the datastore of the Google App Engine (DataNucleus). I have two classes, one Chat and one Rating. A chat can be rated more then ones so I created an one-many relationship by adding a list to the Chat class. 

Now I want to know the number of unrated chats, so I did the following:

    int numberOfChatsInStock = 0;
    for(Chat chat : chats){
      if(chat.getRatings().size() == 0){
        numberOfChatsInStock++;
      }
    }

It simply iterate through all chats and checks if the number of ratings is 0.

This solution works well when there are 10 chats, but when I have 500+ chats then the speed is terrible (15 sec +).

I thought maybe the size() method is faster. So I tried Query.setFilter("ratings.size() == 0") but this gives me the following error:
Unsupported method <size> while parsing expression: InvokeExpression{[PrimaryExpression{ratings}].size(<none>)}

Is there any way to increase the speed?
