【发布时间】:2020-12-09 03:31:10
【问题描述】:
我的 mongo 文档如下所示:
我需要使用 DEC19061936uuuu 进行搜索。 我试过了
db.getCollection('FSL_EventStatusService').find( { $text: { $search: "DEC19061936uuuu" } } )
db.getCollection('FSL_EventStatusService').find( { $text: { $search: "\"DEC19061936uuuu\"" } } )
没有给出结果。每次我获取 0 条记录。 如何使用部分文本搜索进行搜索?这将与 sql 的 like 运算符相同。
{
"_id" : ObjectId("5f3d802666556e3f88f16f65"),
"Timestamp" : ISODate("2020-08-19T19:40:20.886Z"),
"Level" : "Information",
"MessageTemplate" : "{Type}{FeatureTeamName}{ApplicationName}{MethodName}{EntityType}{EntityValue}{ElapsedMilliseconds}{Exception}{Hostname}{CorrelationId}{Message}{CustomException}{AdditionalInfo}{Timestamp}",
"RenderedMessage" : "\"input\"\"FSL\"\"EventStatusService\"\"RabbitMQServices.PushToRMQ\"\"ASN\"\"DEC19061936uuuu\"0null\"W1022MQ8Y2\"\"229fe501-8fb4-4b64-b7f2-1ec3a41eda34\"\"[\\\"Pushed message {\\\\\"KeyName\\\\\":\\\\\"ASN\\\\\",\\\\\"KeyValue\\\\\":[\\\\\"DEC19061936uuuu\\\\\"],\\\\\"DataSource\\\\\":\\\\\"OFS\\\\\",\\\\\"Region\\\\\":\\\\\"EMEA\\\\\",\\\\\"EventType\\\\\":\\\\\"2TRELIEF\\\\\",\\\\\"MessageType\\\\\":\\\\\"2TRELIEF\\\\\",\\\\\"EventTimestamp\\\\\":\\\\\"2020-08-19T14:40:08.321-05:00\\\\\",\\\\\"Attributes\\\\\":[{\\\\\"AttributeName\\\\\":\\\\\"REQUEST_NUM\\\\\",\\\\\"AttributeValue\\\\\":null},{\\\\\"AttributeName\\\\\":\\\\\"TraceID\\\\\",\\\\\"AttributeValue\\\\\":\\\\\"229fe501-8fb4-4b64-b7f2-1ec3a41eda34\\\\\"}]} successfully to Q.FSL.ORCHESTRATION.FSL\\\"]\"nullnull08/19/2020 19:36:03",
"Properties" : {
"Type" : "input",
"FeatureTeamName" : "FSL",
"ApplicationName" : "EventStatusService",
"MethodName" : "RabbitMQServices.PushToRMQ",
"EntityType" : "ASN",
"EntityValue" : "DEC19061936uuuu",
"ElapsedMilliseconds" : 0,
"Exception" : null,
"Hostname" : "W1022MQ8Y2",
"CorrelationId" : "229fe501-8fb4-4b64-b7f2-1ec3a41eda34",
"Message" : "[\"Pushed message {\\\"KeyName\\\":\\\"ASN\\\",\\\"KeyValue\\\":[\\\"DEC19061936uuuu\\\"],\\\"DataSource\\\":\\\"OFS\\\",\\\"Region\\\":\\\"EMEA\\\",\\\"EventType\\\":\\\"2TRELIEF\\\",\\\"MessageType\\\":\\\"2TRELIEF\\\",\\\"EventTimestamp\\\":\\\"2020-08-19T14:40:08.321-05:00\\\",\\\"Attributes\\\":[{\\\"AttributeName\\\":\\\"REQUEST_NUM\\\",\\\"AttributeValue\\\":null},{\\\"AttributeName\\\":\\\"TraceID\\\",\\\"AttributeValue\\\":\\\"229fe501-8fb4-4b64-b7f2-1ec3a41eda34\\\"}]} successfully to Q.FSL.ORCHESTRATION.FSL\"]",
"CustomException" : null,
"AdditionalInfo" : null,
"Timestamp" : "2020-08-19T19:36:03.3161314Z"
},
"UtcTimestamp" : "2020-08-19 19:40:20Z"
}
【问题讨论】:
-
如果将正在搜索的字段中的所有标点符号替换为空格会怎样?
-
RenderMessage字段是否有文本索引。
标签: mongodb mongodb-query robo3t