This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi! I'm trying to do something like this:
The problem is that I get "Query Error: Could not find field [Count] on model [Post]". Both User and Post are objects stored in the database and there is a many-to-one releationship between Post and User. How can I select x users from the db that I know have atleast one post?
//Magnus
|
|
|
Hi Magnus, We don't yet support the general Count case, but you can do the specific case of "at least one" through the native LightSpeed API using an Exists query: var featuredUsers = unit.Find<User>(Entity.Attribute("Posts").Exists()); To get the Take(6) and the orderby u.Id descending in the native API, use a Query object and set the Page and Order properties: Query query = new Query(Entity.Attribute("Posts").Exists()); |
|