title: How to use not equal operator in mongoose/mongodb?
body: <p>Here is the structure of the document.</p>
  
  <pre><code>{
      "_id" : ObjectId("5548f1cc0dcd6bd925a71ae2"), //document id
      "messages" : [
          {
              "subject" : "NEW ++ SUBJECT",
              "from" : ObjectId("5534b2992a104ed914435c31"),
              "_id" : ObjectId("5548f1cc0dcd6bd925a71ae3"),
              "created" : ISODate("2015-05-05T16:37:32.832Z"),
              "read" : false,
              "message" : "FIRST MESSAGE",
              "participants" : [
                  ObjectId("5534b2992a104ed914435c31"),
                  ObjectId("5530af38576214dd3553331c")
              ]
          },
          {
              "subject" : "dfgsd",
              "from" : ObjectId("5534b2992a104ed914435c98"),//logged In USer
              "_id" : ObjectId("5548f1df0dcd6bd925a71ae4"),
              "created" : ISODate("2015-05-05T16:37:51.455Z"),
              "read" : false,
              "message" : "rdfgdgfd",
              "participants" : [
                  ObjectId("5534b2992a104ed914435c98"),//logged In USer
                  ObjectId("5530af38576214dd3553331c")
              ]
          }
      "participants" : [
          ObjectId("5534b2992a104ed914435c98"),//logged In USer
          ObjectId("5534b2992a104ed914435c31"),
          ObjectId("5530af38576214dd3553331c")
      ],
      "__v" : 3
  
  }
  </code></pre>
  
  <p>I want to get the message objects of the messages array whose 'read' value is 'false' &amp; 'from' is NOT EQUAL TO LOGGED IN USER ( here logged in user is 5534b2992a104ed914435c98). And the 'participants' array of the document has to contain logged in user id(5534b2992a104ed914435c98). Here is the query I tried.</p>
  
  <pre><code>db.conversations.find({participants:ObjectId('5534b2992a104ed914435c98'),'messag‌​es.read':false,'messages.from':{$ne:ObjectId('5534b2992a104ed914435c98')}}).prett‌​y().
  </code></pre>
  
  <p>Basically I am trying to get the count of unread messages.
  I am very new to mongodb/mongoose. Please correct me if you find something wrong in the question.</p>