Index with Map and Reduce that Looks at Internal Types #17070
Unanswered
mfonnesbeck
asked this question in
Q&A
Replies: 1 comment
-
Remember that on the server side, you don't actually have your types. It is all JSON. What you can do is use a JS index, and just operate over the json structure directly |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an object that contains a history array. The base type of history items is TicketHistoryItem which contains a Timestamp value of when the history change was made, but this history item in the array could be either of the following descendant classes: TicketStatusHistoryItem holding a change in statuses of the original object, a TicketCategoryHistoryItem holding changes in the category of the original object, or a two other types of changes. Internal in the stored document it has a $type value storing the actual class this history item is and lists the fully qualified namespace and class name.
There is a need for querying these objects and grouping them by the TicketStatusHistoryItem history types and getting a count of them based upon the dates (Timestamp) that the changes were made. In order to count how many were a particular status on a date.
Is there a way to create an index that looks at the $type property and filters those objects that contain a TicketStatusHistoryItem with a particular status in the history array? I've tried various ways of accessing this array and filtering/grouping without success and not found any examples as complicated as this in the docs.
Beta Was this translation helpful? Give feedback.
All reactions