Data Models

MongoDB entity schemas and document structures for the User Service.

Overview

The arya-banking-user-service uses Spring Data MongoDB. All entities inherit from AryaBase (provided by the common library), which adds auditing fields (createdAt, updatedAt, version).


User Entity

Stored in the user collection.

FieldTypeDescription
userIdStringUnique application ID (e.g., ARYA123456)
firstNameStringUser's first name
lastNameStringUser's last name
emailIdStringUnique email address
primaryContactNumberStringPrimary mobile number
statusEnumACTIVE, INACTIVE, BLOCKED, DELETED
contactNumbersListHistory of all contact numbers
addressesListPhysical addresses (Permanent/Residential)

Registration Progress

Stored in the registration_progress collection. Tracks the 3-step onboarding flow.

FieldTypeDescription
userIdStringReference to the user
statusStringBroad status (REGISTRATION_IN_PROGRESS, REGISTRATION_COMPLETE)
subStatusEnumStep detail (BASIC_DETAILS_ADDED, ADDRESS_ADDED, etc.)
nextStepStringAdvice for the UI on what endpoint to call next

Security Details

Stored in the security_details collection.

FieldTypeDescription
userIdStringReference to the user
loginFailedAttemptsIntegerCounter for failed logins (max 5)
securityQuestionsListArray of Q&A pairs
isAccountLockedBooleanRead-only flag based on attempts

Indexing Strategy

  • User: Unique index on userId and emailId.
  • RegistrationProgress: Compound index on userId and subStatus.
  • SecurityDetails: Unique index on userId.
All collections use Spring Data MongoDB auditing to keep track of record creation and modification times.