title: How create a MongoDB query
body: <p>I have a collection with some documents like below:</p>
  
  <pre><code>{
      "_id" : ObjectId("1"),
      "className" : "model.MyClass",
      "createdOn" : ISODate("2018-10-23T11:00:00.000+01:00"),
      "status" : "A"
  }
  
  {
      "_id" : ObjectId("2"),
      "className" : "model.MyClass",
      "createdOn" : ISODate("2018-10-23T11:01:00.000+01:00"),
      "status" : "B"
  }
  
  {
      "_id" : ObjectId("3"),
      "className" : "model.MyClass",
      "createdOn" : ISODate("2018-10-23T11:02:00.000+01:00"),
      "status" : "C"
  }
  
  {
      "_id" : ObjectId("4"),
      "className" : "model.MyClass",
      "createdOn" : ISODate("2018-10-23T11:03:00.000+01:00"),
      "status" : "D"
  }
  </code></pre>
  
  <p>Given a specific ID, how can I get the previous document that whose status not equals a specific status.</p>
  
  <p>For example, I give the ID 4 and like to get the last document that status not is B neither C. So, I get the Object with Id 1.</p>
  
  <p>How to create this query?</p>