Getting count of documents in large collection

Thanks for the good advice.
Now I use db.collection.estimatedDocumentCount().
But if I want to find query What’s the best way?