Yes you are correct, it is not the best of solutions. While your initial approach works, it can become inefficient as the array grows larger.
MongoDB's array performance decreases when modifying large arrays, thus updating individual notes within an array can be cumbersome.
A more efficient and scalable solution would be create separate collections for the users and notes, and then create a relationship between the users and the notes collection using a reference to the user (i.e., username or user ID). This allows MongoDB to efficiently index and query notes, making operations like adding, deleting, or updating specific notes much easier and faster.
Hope this answers your question