London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Search for null objects

Vote:
 

Hi,

I need to find all objects which doesn't have any categories.

At the moment I've tried something like this:

query = query.Filter(x => x.SearchCategories.IsNull().Match(true));

But it doesn't work. Is it possible to search for null values?

#79942
Jan 10, 2014 13:27
Vote:
 

You should be able to use .Exists(): 

query = query.Filter(x => x.SearchCategories.Exists());

    

#79951
Jan 10, 2014 14:17
Vote:
 

Thank you! It works beautifuly.

Ended using it like this:

query = query.Filter(x => !x.SearchCategories.Exists());

#79953
Jan 10, 2014 14:36
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.