ahaan
ahaan10mo ago

need help understanding a code

favorites: defineTable({ fileId: v.id("files"), orgId: v.string(), userId: v.id("users"), }).index("by_userId_orgId_fileId", ["userId", "orgId", "fileId"]), here does it make any sense for creating index with all 3 columns?
1 Reply
Dhruv Kumar Jha
Dhruv Kumar Jha10mo ago
If you're filtering by all these 3 fields then yes it makes sense. You can also create multiple indexes with different fields. BTW why is orgId type string?

Did you find this page helpful?