What collections does DevTinder use in MongoDB?
Three collections: users (user profiles with name, email, password, photo, skills, about), connectionrequests (connection requests with from, to, status), and messages (chat messages with sender, receiver, text).
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in DevTinder Database Design and Schema MongoDB Collections and Relationships
Using ObjectId references (ref) in Mongoose. ConnectionRequest references two users (fromUserId, toUserId). Message references sender and receiver. Use populate() to fetch the full user document when needed.
The compound unique index on fromUserId and toUserId prevents duplicate connection requests between the same pair of users at the database level, ensuring data integrity even if the application logic fails.
A compound index on senderId, receiverId, and createdAt (descending). This optimizes the most common query fetching message history between two users in reverse chronological order with pagination.
Still have questions?
Browse all our FAQs or reach out to our support team
