title: Atomicity of findAndModify on embedded documents
body: <p>On mongodb manual there is an <a href="http://docs.mongodb.org/manual/tutorial/model-data-for-atomic-operations/" rel="nofollow">example</a> for atomic operations on a single document.</p>
  
  <pre><code>book = {
            _id: 123456789,
            title: "MongoDB: The Definitive Guide",
            available: 3,
            checkout: [ { by: "joe", date: ISODate("2012-10-15") } ]
          }
  </code></pre>
  
  <p>The manual states that the below operation is atomic:</p>
  
  <pre><code>db.books.findAndModify ( {
     query: {
              _id: 123456789,
  
              available: { $gt: 0 }
            },
     update: {
               $inc: { available: -1 },
               $push: { checkout: { by: "abc", date: new Date() } }
             }
  } )
  </code></pre>
  
  <p>My question is what would happen if available field was an embedded document. Such as below:</p>
  
  <pre><code>book = {
            _id: 123456789,
            title: "MongoDB: The Definitive Guide",
            available: [ { value: 3, valueFloat: 3.00 ] },
            checkout: [ { by: "joe", date: ISODate("2012-10-15") } ]
          }
  </code></pre>
  
  <p>Could I still do this operation atomically? If so, how?</p>