skip to Main Content

Json – MongoDB Sorting Not Working as Expected in C# with Aggregate Lookup

I'm trying to sort a list in MongoDB using C# with the following method: public async Task<SearchResponseDTO<CampaignValidateDTO>> Search(SearchRequestDTO<CampaignValidateSearchFilterDTO> searchRequestDTO, string tenantId) { var filterDefinition = GetSearchFilter(searchRequestDTO, tenantId); var totalItems = await mongoCollection.CountDocumentsAsync(filterDefinition); var itemsWithLookup = await mongoCollection.Aggregate() .Match(filterDefinition) .As<CampaignValidateDTO>() .Lookup<CampaignValidateDTO,…

VIEW QUESTION

Json – How to extracting only the Token from RestAPI response

I have this code that gets the token from RestAPI // Prepare JSON content var content = new StringContent(jsonContent, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync(tokenEndpoint, content); if (response.IsSuccessStatusCode) { string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine("Token received: " + responseBody);…

VIEW QUESTION
Back To Top
Search