How does mongodb build an index to find faster

how to build an index query in

mongodb is faster

{"_ id": ObjectId ("5bc4306ec3474d78e3780213"), "name": "Japan currency Exchange Association-status report on Virtual currency transactions (Japanese)-April 10, 2018.40. Pdf", "unique_charcter": "FiFhAChi7LSJxIq6IGdEjgHhiLPK"}
{"_ id": ObjectId ("5bc4306ec3474d78e3780214"), "name": "Uncle Akiba-give you a community-how do you manage v2-42 pages", "unique_charcter": "lnQuwPAAWDexZKnV1XbBjDRDNA71"}
{"_ id": ObjectId ("5bc4306ec3474d78e3780215"), "name": "Qing Ke-Qing Ke observation: the localization of depositary receipts has been officially recognized. Exclusive interpretation of overseas Chinese enterprises" CDR model return path to A shares-2018.4-13 pages. Pdf "," unique_charcter ":" FkWuGa1VKwZj9o4w06-2hiX-GCQL "}
{" _ id ": ObjectId (" 5bc4306ec3474d78e3780216 ")," name ":" iRui-2018 China bedtime Audio listening scene Research report-2018.3-38 pages .pdf "," unique_charcter ":" FtU78sk1Emm50IRs89mQYYvc67lX "}
{" _ id ": ObjectId (" 5bc4306ec3474d78e3780217 "), "name": "Global Life Science Development trend of Deloitte-2018 (English)-2018-41 .pdf", "unique_charcter": "FjrR7vLkB6fjOONFB04hGq1pqsmm"}
{"_ id": ObjectId ("5bc4306ec3474d78e3780218"), "name": "iResearch-2018 China Financial New Media Industry Insight report-2018.3-48 pages .pdf", "unique_charcter": "FlXpGnt8-dTi6D5JQm9S0UsdSRYL"}
{"_ id": ObjectId ("5bc4306ec3474d78e3780219"), "name": "iResearch-2018 China sharing portable battery Industry Research report-2018.3-44 pages .pdf", "unique_charcter": "Fiiab691SQI3U8LRNNP1nWPdeiCC"}

now I"m the key that name and unique_charcter created together. How can I make find queries faster?
self.xiaoMiQuanCollection.ensureIndex (key_word)
is that all right?

Sep.27,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5b252-27b42.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5b252-27b42.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?