Why use refs instead of embedded arrays for messages and connections?
Embedded arrays grow documents unboundedly. MongoDB has a 16MB document limit, and large arrays slow down every read. Refs keep documents small and let you paginate.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in DevTinder Database Schema Overview
User, ConnectionRequest, Connection (match), Message, Payment, and Subscription. Each handles a specific module: users, swipes, matches, chat, payments, and plan status.
It prevents duplicate swipe attempts (a user cannot swipe on the same target twice) and speeds up the most common query: "did A already swipe on B?" Compound unique indexes serve both integrity and performance.
A unique index on (user1Id, user2Id) where user1Id < user2Id ordering. This makes a match between A and B have one canonical form, so two requests cannot create the same match.
Still have questions?
Browse all our FAQs or reach out to our support team
