title: Find values from MongDB from an array for only one date
body: <p>I am aware of a similar question available in SO but mine is little different <a href="https://stackoverflow.com/q/33708704/5189062">Find values in mongdb</a>. I am trying out a hotel booking app. Here I store the info about on which date the rooms are booked, which means the rooms are available in all other dates. I am working with <code>mongodb</code> and <code>python</code>.</p>
  
  <p>I am using the <code>$nin</code> function. I have a option called alternate dates, where the user gives in another date. I want to display the availability of only one day that is, if room is available on the first date then the search should stop if not it should continue to the next date and give result if available.</p>
  
  <p>This solution gives result for all the given dates.
  <a href="https://stackoverflow.com/a/33708740/5189062">solution of Find values in mongdb</a></p>
  
  <p>The data stored is </p>
  
  <pre><code>{
      "_id" : ObjectId("5645f0443f32df13e0dc786e"),
      "Booked Date" : ["28-9-2015","29-9-2015","1-10-2015"],
      "Room No.": "101"
  },
  {
      "_id" : ObjectId("5645f0c73f32df062064a0f6"),
      "Booked Date" : ["29-9-2015","1-10-2015"],
      "Room No.": "102"
  },
  {
      "_id" : ObjectId("5645f0c73f32df06205874f8"),
      "Booked Date" : ["29-9-2015","1-10-2015","2-10-2015"],
      "Room No.": "103"
  },
  </code></pre>
  
  <p>I do the query like this</p>
  
  <pre><code>db.booking.find({"Date": { '$nin':[Date]}},{"_id": False,"Booked Date": False})
  </code></pre>
  
  <p>Here I give the input as <code>["1-10-2015","2-10-2015"]</code></p>
  
  <p>So when I get the result I don't know on which date the room is available.</p>
  
  <p>Is there a way I can solve this problem.</p>
  
  <p>When I run this code </p>
  
  <pre><code>db.booking.find({"Date": { '$nin':["1-10-2015","2-10-2015"]}},{"_id": False,"Booked Date": False})
  </code></pre>
  
  <p>I get the result</p>
  
  <pre><code>{"Room No.": "101"}, 
  {"Room No.": "102"}
  </code></pre>
  
  <p>But I dont know for which date the room is available. In the above case it is available only on <code>2-10-2015</code>.</p>
  
  <p>So is there a way to say that it is available on <code>2-10-2015</code>.</p>
  
  <p>And for another case:</p>
  
  <pre><code>db.booking.find({"Date": { '$nin':["1-10-2015","2-10-2015", "3-10-2015"]}},{"_id": False,"Booked Date": False})
  </code></pre>
  
  <p>Here it is available on <code>2-10-2015 &amp; 3-10-2015</code>, but it should show only the first availability date i.e <code>2-10-2015</code>.</p>
  
  <p>The output should be the same as above:</p>
  
  <pre><code>{"Room No.": "101"},
  {"Room No.": "102"}
  </code></pre>