Join MongoDB strings array

 

User LAST LOGIN stats

Get datetime of last successful login of each user – from logs collection

 

Count documents using Aggregation

Counts log entries,  with type equal 'CREATE’ , fetch patients data  from another collection,  remove empty documents (if patients was not found the field is empty array), count by provided user id.

 

MongoDB – lookup example

 

MongoDB – usunąć osamotnione dokumenty – błędne $ref

ModelInstance jest kolekcją dokumentów w której każdy dokumnt posiada referencję do model, np.

Zadanie: usunąć wszystkie dokumenty które wskazują na nieistniejące modele.