1 Resposta
- Mais recentes
- Mais votos
- Mais comentários
0
Hello AWS Customer
From the details provided , kindly allow me to mention it seems in both cases you have provided similar query. Based on the testing in my environment, I can see that query is working and not providing any error.
Testing Details :
Created collection :
rs0:PRIMARY> db.createCollection("mycoll")
{ "ok" : 1, "operationTime" : Timestamp(1698782387, 1) }
Inserted data :
rs0:PRIMARY> db.mycoll.insert({"name":"anushka", "age":54, "Test" : { "Date" : "2023-06-04T02:52:25.638-07:00", "Status" : "Completed" }});
WriteResult({ "nInserted" : 1 })
rs0:PRIMARY> db.mycoll.insert({"name":"joe", "age":45, "Test" : { "Date" : "2023-05-04T02:52:25.638-07:00", "Status" : "Pending" }});
WriteResult({ "nInserted" : 1 })
Find query :
rs0:PRIMARY> db.mycoll.findOne({"name":"joe"});
{
"_id" : ObjectId("65415cb455a04e2c7cda0bc3"),
"name" : "joe",
"age" : 45,
"Test" : {
"Date" : "2023-05-04T02:52:25.638-07:00",
"Status" : "Pending"
}
}
Running provided query
rs0:PRIMARY> db.getCollection('mycoll').aggregate([ { $match: { _id: /^xx/ } } ], {hint: {_id: 1}, explain: true })
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "test.mycoll",
"winningPlan" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXOR",
"inputStages" : [
{
"stage" : "IXSCAN",
"indexName" : "_id_"
},
{
"stage" : "IXSCAN",
"indexName" : "_id_"
}
]
}
}
},
"serverInfo" : {
"host" : "checkdb",
"port" : 27017,
"version" : "5.0.0"
},
"ok" : 1,
"operationTime" : Timestamp(1698782503, 1)
}
Since complete details are not present their might be few miss in replicating the use case.
To answer your question, we require additional details to replicate your use case for getting better understanding of the issue and help you resolve it. Please open a support case with AWS using the following link [+] https://console.aws.amazon.com/support/home#/case/create
Thank you for your kind patience with us.
respondido há 6 meses
Conteúdo relevante
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há 7 meses
Thank you, I updated the question, the second statement searches for strings starting with "/xx", I.e the regex contains an escape character in the beginning.