An update in MongoDB will only update one record by default. You have an option to update all the matching documents in a query with {multi:true}
option but by default your update will only update one document.
So what you have to do is combine your "query" into your update statement so they execute atomically (just like you do it in SQL) and not do two separate operations. In shell syntax, something like:
db.queueing.update({conditions}, {$set:{status:2}})
Now, if you also need the task document you updated to work with then you can use findAndModify to update and return the document in one atomic operation. Like this:
task = db.queueing.findAndModify( {your-condition},
sort: { your-ordering },
update: { $set: { status: 2 } }
} );