mongodbcompass

MongoDB compass Query


I have Data like this

{
"_id": {
    "$oid": "61cc17d0e465f648b6d3da61"
},
"Level": "Error",
"UtcTimeStamp": {
    "$date": "2021-12-29T08:09:52.191Z"
},
"MessageTemplate": {
    "Text": "İşlem sırasında bir hata oluştu!",
    "Tokens": [{
        "_t": "TextToken",
        "StartIndex": 0,
        "Text": "İşlem sırasında bir hata oluştu!"
    }]
},
"RenderedMessage": "İşlem sırasında bir hata oluştu!",
"Properties": {
    "EventId": {
        "Id": 5001
    },
    "SourceContext": "NotificationController",
    "ActionId": "9567ad03-89d0-4de9-986e-0432ea30b964",
    "ActionName": "AcerPlatformV2.Presentation.Controllers.NotificationController.GetNotificationById (AcerPlatformV2.Presentation)",
    "RequestId": "800081d9-0000-f600-b63f-84710c7967bb",
    "RequestPath": "/GetNotificationById",
    "ApplicationName": "WebUI"
},
"Exception": {
    "_t": "FormatException",
    "HelpLink": null,
    "Source": "System.Private.CoreLib",
    "HResult": -2146233033,
    "Message": "Input string was not in a correct format.",
    "StackTrace": "   at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)\r\n   at System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)\r\n   at System.Convert.ToInt32(String value)\r\n   at AcerPlatformV2.Presentation.Controllers.NotificationController.GetNotificationById(String id, String notificationType) in C:\\BuildAgent\\_work\\5\\s\\AcerPlatformV2.Presentation\\Controllers\\NotificationController.cs:line 106\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)",
    "Data": {}
}

}

I want to filter Data with desired RequestID in MongoDB compass. Actually I dont lnow how I can retrive data having desired RequestId.


Solution

  • db.collection.find({
      "Properties.RequestId" : "800081d9-0000-f600-b63f-84710c7967bb"
    })
    

    It's simple find command. But not the quotes and period(.) in the key part.

    In compass, you need to give the below in the query textarea.

    { "Properties.RequestId" : "800081d9-0000-f600-b63f-84710c7967bb" }