Question Details

No question body available.

Tags

mongodb bash mongosh

Answers (1)

June 20, 2026 Score: 0 Rep: 60,790 Quality: Low Completeness: 50%

Strange behavior, I don't see any reason why it should fail. Here are some alternatives you may try, without the need to create extra files:

mongosh HIFRRMGP --eval "db.AuditLogCollection.countDocuments({}, { hint: 'id' })"

echo 'db.AuditLogCollection.countDocuments({}, { hint: "id" })' | mongosh HIFRRMGP

mongosh HIFRRMGP