title: How to limit/filter a query of messages to just the most recent message
body: <p>I'm building a message inbox and it's pretty much all set! On the list of all messages, it literally has every message. I'd like this to just be a list of conversations. So instead of showing 10 messages from Person A, it only shows the most recent message from Person A. It'd also have to be an OR condition where the receiver is either person A OR person B. The same could be true of the sender. The sender is either person A OR person B.</p>
  
  <pre><code>&lt;div ng-repeat="message in messages.messages" ng-class="{unread: !message.read}"&gt;
           &lt;h5&gt;{{message.sender}}&lt;/h5&gt;
          &lt;a href="#view-message" data-toggle="modal" data-dismiss="modal" ng-click="viewMessage(message)"&gt;{{message.message.message}}&lt;/a&gt;
          &lt;i&gt;Sent {{timeAgo(message.sent)}}&lt;/i&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here's the current backend to get every message instead of every conversation.</p>
  
  <pre><code>db.collection('messages', function (err, collection) {
      collection.find({
          receiver: req.user._id
      }).sort({
          date: -1
      }).toArray(function (err, docs) {
          if (err) {
              console.log('Error getting messages', err);
              throw err;
          }
          if (docs) {
              console.log('Found some messages');
              console.log(docs);
              res.send({
                  messages: docs
              });
          } else {
              console.log('Didnt find messages');
              res.send({
                  messages: []
              });
          }
      })
  });
  </code></pre>