Day 5 — Completing Task entity, Solved an obvious bug

Olaoluwa Oke| 26 June 2023

When I sat down today, I just wanted to run the application and see where things stood. Instead, I was greeted with:

"message": "Something went wrong: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='...........', source='admin', password=, mechanismProperties=}",  
"timestamp": "2025-06-24T20:47:29.095021900Z"


I recognized it right away. Postman helped confirm it, but honestly, the real MVP was my Global Exception Handler from the previous day — it formatted the error so cleanly that I knew exactly what to check first. Debugging didn’t feel like guesswork anymore.

The culprit? My MongoDB connection string had vanished from my environment variables. After re-adding it, I still hit the same wall — because the password I was using was wrong. Seven minutes later, it clicked: I needed to update the credentials in MongoDB Atlas as well. Once I did that, the connection came back to life.

My MongoDB connection string had somehow disappeared from my environment variables. I re-added it, but the password I used was wrong. It took about seven minutes to realize I needed to update the credentials in MongoDB Atlas as well. After doing that, everything connected.

Later, I worked on the "mark task as complete" feature. At first, I made a request like this:

PATCH http://localhost:8080/api/task/room/user/68534f4f9c2ee8a8a041f5a5/status?isComplete="false"



Wrong for two reasons:
  1. "false" was in quotes — I was sending a boolean as a string.
  2. The URL didn’t match my endpoint mapping at all.


My controller was:
@PatchMapping("/{taskId}/complete")
fun markTaskComplete(
    @PathVariable roomId: String,
    @PathVariable taskId: String,
    @RequestParam userId: String
)
The base route was:
@RequestMapping("/api/room/{roomId}/task")

So the correct request should have been:
PATCH http://localhost:8080/api/room/{roomId}/task/{taskId}/complete?userId={userId}

Once I hit that correctly, it worked.

Technical Log

1. MongoDB Credential Error Flow
  • Symptom: SCRAM-SHA-1 authentication error on startup.
  • Cause: Missing environment variable + outdated Atlas password.
  • Fix:
    1. Re-add MONGODB_URI in .env.
    2. Update database user credentials in MongoDB Atlas.
    3. Restart app to refresh connection.


    3. Implemented Task Endpoints
  • createTask
  • updateTask
  • getTask
  • getTasksByRoom
  • getCompletedTasksByRoom
  • getTasksByRoomAndStatus
  • getUpcomingTasks
  • markTaskAsComplete
  • regenerateRecurringTasks
  • getTasksByUsers
  • getTasksByUsersAndStatus


  • 4. Recurring Tasks — Pending Design

    Current thought process:
  • store recurrence pattern in Task (DAILY, WEEKLY, etc.).
  • Nightly cron job to clone tasks into upcoming intervals.
  • Avoid duplication by checking if a recurrence-generated task already exists for that time window.