GGuileasinblog.etheve.eu·Jun 28, 2024 · 3 min readMongoDB: Join and Format Array of DataIf you have an array of id and you want to retrieve data from another table and filter the properties to return you will use the aggregate feature of mongo and create a pipeline like so: $match - to retrieve the document you're interested in and the...00
GGuileasinblog.etheve.eu·Jun 12, 2024 · 1 min readMongoDB - Prevent duplication in your arraysWhen we want to insert data in an array in Mongo we use $push . But it won't prevent you from inserting multiple times the same value in your array. If you want to ensure that there's no duplication. You can use : $addToSet How it works When you want...00
GGuileasinblog.etheve.eu·Jun 6, 2024 · 3 min readAngular - Custom Structural DirectivesI've sometimes asked myself what are *ngIf and *ngFor in Angular but never dig into it before until I faced a case where none of the knowledge I had about Angular concept at that time (services, validators, guards, interceptors, directives) would giv...00
GGuileasinblog.etheve.eu·May 11, 2024 · 1 min readDeno Mysql - Query VS ExecuteWhen you look at the Deno Mysql documentation you can use two functions to run your query : client.execute(/*SQL*/) client.query(/*SQL*/) I wasn't sure when to use what, so I consulted the code to find out. Both function work the same as the query f...00
GGuileasinblog.etheve.eu·May 8, 2024 · 1 min readMongoose - Add a unique index on an existing collectionWhen you work with MondoDB you often use indexes to optimize your query. If you want to create a unique index to prevent duplicated entries for a specific field (like email or username for example) on a new collection you can do it by adding the uniq...00