How can I update priority list after deleting a record in MongoDB using Spring Boot?

I have a Spring Boot application connected to a MongoDB. In the MongoDB I have a collections called configurations with the following documents: _id: ObjectId(‘6231984016d57c64884c8e52′) name: Gio priority: 1 _id: ObjectId(’61f2a0351a7b18283fc5ce9b’) name: Blamee priority: 2 _id: ObjectId(’61f39f8ae2daa732deff6d90′) name: Lonic priority: 3 _id: ObjectId(’61e56339b528bf009feca149′) name: TechRaz priority: 4 _id: ObjectId(‘62013a86b6b62621b529bed4’) name: Gild priority: 5 All the… Read More How can I update priority list after deleting a record in MongoDB using Spring Boot?

Calculate distinct count on fields in mongodb

I have following collection: [{ "id": 1, "activity_type": "view", "user_id": 1 }, { "id": 2, "activity_type": "save", "user_id": 1 }, { "id": 3, "activity_type": "save", "user_id": 1 }, { "id": 4, "activity_type": "save", "user_id": 2 }] I need to get a result like this: [{ "activity_type": "view", "count": 1, "user_count": 1 },{ "activity_type": "save", "count":… Read More Calculate distinct count on fields in mongodb