Collection.count() and deprecated in PyMongo and replaced by two methods:
estimated_document_count() that always metadata-only, may be inaccurate and does not support transactions, but is always lightning-fast
count_documents() that uses a simple aggregation pipeline under the hood, always correct and supports transactions.
TxMongo should do the same.