Today, applyOperation_inlock() builds and executes an entire Query plan to do each replicated 'u' update and 'd' delete operation. This method has a lot of overhead that could be avoided. I believe we can avoid the query code entirely for simplification and performance improvements.
For example, instead of calling deleteObjects(), the delete code could instead:
1. Find the RecordId of the document to be deleted by doing a point lookup for the _id field in the _id index (use IndexAccessMethod::findSingle()).
2. Use that RecordId in a call to Collection::deleteDocument().
For update operations, a similar (but a bit more involved) method could be used.