Here the different models of the database:
One important thing to have in mind that is different from sql in mongo is:
In general, you should structure your schema so your application receives all of its required information in a single read operation.
Note
- type: [’note’, ’todo’, ‘private’,….] - Different type of notes, for not we are only considering note
- visibility: [‘public’, ‘private’] - Note public or private
- content: The content of the note
- _id: Id of the note with the format YYYYMMDDHHMMSS
- out_relations:
- _id
- title
- type
- visibilty
 
- in_relations:
- _id
- title
- type
- visibilty
 
Example of note:
{
    "_id": 20220108133455,  // id in format YYYYMMDDHHMMSS
    "visibility": "public",
    "title": "Yendo a comprar en la yeepeta",
    "type": "note",
    "content": "Hola Caracola\nHola caracol",
    "out_relations": {
        "_id": 20211231165555,
        "title": "Tomando las uvas con la familia",
        "type": "note",
        "visibility": "public"
    },
    "in_relations": {
        "_id": 20220130175555,
        "title": "Cosas que hice en navidad",
        "type": "note",
        "visibility": "public"
    }
}