I was learning index and thought of checking how plan work with findOne. When I executed below query
the below exception is raised:
uncaught exception: TypeError: db.people.findOne(…).explain is not a function
Hello @Yadvinder_Kumar, welcome to the forum.
explain method cannot be used with the
findOne method. Here are the list of methods on which the
explain can be used with: db.collection.explain
Explain can be used two ways, with the find method:
find method returns a cursor. You can apply the explain on the cursor.
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.