I am trying to model a simple chat application that has “conversations” that contain “messages”. Each message being a separate document.
The “messages” documents are not synchronized, they serve as a local cache for messages (among other things) that are delivered through XMPP.
I am having trouble modelling the view that shows conversations ordered by “last message” like any messenger app does. Currently we have a separate document that only contains the conversation ID and a “last message date” property that is updated for every single message. This way we can create a really simple view that emits the last date.
Can we find a schema where we don’t have this third document type and have a view that will emit values in a way that allows us to order the conversations by “last message” ?