• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

291
Views
Indexing on MongoDB UUID field

I have a table in MongoDB having UUID field named artwork_id, and i need to create index on that field, which type of index will be better?

db.artwork_images.createIndex( { artwork_id: "text" } )

OR

db.artwork_images.createIndex( { artwork_id: 1 } )

[Image of UUID field here][1] [1]: https://i.stack.imgur.com/XvHsN.png

about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

Text indexes are meant to match words inside a field without having to access to the document. In this case you have an UUID field, so you are going to match the whole string every time.

Regular indexes are useful for matching the entire value of a field. If you only want to match on a specific word in a field with a lot of text, then use a text index.

I recommend to have a look to this post Performance best practices indexing

about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error