在Breeze.js计数

问题描述:

我有一个复杂的查询,返回项目计数。如果我在客户端上运行一个查询,将它始终返回的对象,或者是有没有办法只返回项目计数无有效载荷发送对象数组?我试图做类似

I have a complex query that returns item counts. If I run a query on the client, will it always return the objects, or is there a way to just return the item counts without sending the object array in the payload? I tried doing something like

var query = breeze.EntityQuery.from('Items').inlineCount(true);

但仍然拉的所有记录下来。任何解决方案?

but that still pulls all the records down. Any solutions?

我不知道这是否正是回答你的问题,但你需要查询才能知道有多少(据我所知纪录,有可能是一个更有效的方式,以配合微风直接到SQL命令是远远超过我的头),所以你可以这样做 -

I don't know if this exactly answers your question, but you would need to query the records in order to know how many there are (to my knowledge, there may be a more efficient way to tie Breeze directly into a SQL command that is way over my head) so you could do something like -

var query = breeze.EntityQuery.from('Items')
    .take(0)
    .inlineCount(true);

编辑答案 - 这将不返回任何对象,并简单地得到计数

Edited the answer - this would return no objects and simply get the count.