Uploaded image for project: 'Realm Cocoa SDK'
  1. Realm Cocoa SDK
  2. RCOCOA-185

Allow @sum Keypath Collection Operator, and sumOfProperty: on BOOL properties.

      This is what my models look like.

      @interface FeedItem : RLMObject
      @property NSString *title;
      @property BOOL isUnread;
      @end
      RLM_ARRAY_TYPE(FeedItem)
      @interface Feed : RLMObject
      @property NSString *title;
      @property RLMArray<FeedItem *><FeedItem> *items;
      @end
      

      Now, say I want display to a user, an auto-updating list of only those feeds that have (1 or more) unread items, in a UITableView.
      Ideally, I would fetch it like this:

      RLMResults *unreadFeeds = [Feed objectsWithPredicate:[NSPredicate predicateWithFormat: @"items.@sum.isUnread < 0"]];
      

      But, with the above query, Realm throws an exception with the reason: '@sum can only be applied to a numeric property.'

      Any chance, we can get support for this operator on BOOL properties?

      I have several other use cases for sumOfProperty: to also be allowed on BOOL properties, and in general all 'Aggregating Property Values' methods to be made available on RLMArray.

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: