Explain() error for findOne query

Hello,

It is a coding shortcut only.
findOne() is basically a shorthand to do a find().limit(1)

The query optimisation and execution are the same.

As you know while find returns a cursor, findOne returns a document instead. The method explain() belongs to cursor object. This is the reason it is not possible call explain with findOne.

Please read this discussion:

Thanks
WeDoTheBest4You