Error -- Option "explain" cannot be used on an aggregate call with writeConcern

This is my connection string -
mongodb+srv://clustername:password@clustername.rq1blmy.mongodb.net/company?retryWrites=true&w=majority&appName=Clustername

this is the query i just used -

db.orders.explain(“executionStats”).aggregate([
{
$lookup: {
from: “A”,
localField: “B”,
foreignField: “_id”,
as: “details”
}
},
{
$unwind: “$details”
},
{
$lookup: {
from: “C”,
localField: “_id”,
foreignField: “_id”,
as: “details”
}
},
{
$unwind: “$details”
}
]);

I had tried with multiple updated queries. but all the time i got the Error -
*Option “explain” cannot be used on an aggregate call with writeConcern

How to resolve this error ?

Or is there any other way to find out Execution Time of queries ??

Hi @Prem_kumar_Madheswaran,

This will help you to solve your error.:

Best,
Shreya

Hello shreya_thakrar, Thanks for your support

I read this article yesterday, but it doesn’t have a proper solution for this.
Kindly help me with some other ways.

Hello @Prem_kumar_Madheswaran,

Well, I’m not sure what the other solution will be in this case :thinking:. I’ll try to find out and get back to you if I’ll have.

Best,
Shreya