title: MongoDB: Designing a db for saving chats / offline / undelivered chats
body: <p>I am trying to create a mongodb design to support a chat application. The system needs to write the message to a collection with a status of delivered (boolean) and read (boolean).</p>
  
  <p>1 message would be able to be sent to more than 1 person.</p>
  
  <p>Anybody know of a good schema for this type of thing in the mongodb schemaless design?</p>
  
  <p>I was thinking of have a array inside the collection that would contain another document that would have 3 properties.. "name of person addressed to", "read (boolean)" and "delivered (boolean)".</p>
  
  <p>This way at runtime I can reach into the db using dot notation to find all messages addressed to a specific person, all unread messages, all undelivered messsages etc.</p>
  
  <p>I think I need to have another property too "name of person sent from", so i am able to rebuild the a list of messages sent and there status </p>
  
  <p>Has anyone seen a good setup for this ?</p>
  
  <p>Am I thinking this correctly or is there a better way of achieving such a solution</p>