Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
3.0.3
-
None
-
ALL
-
Description
I was executing the below query on the enron dataset provided as part of MongoDB university training.
m101:PRIMARY> db.messages.aggregate([ {$unwind:"$headers.To"}, {$group:{_id:{id
|
: '$_id', from:'$headers.From'}, to:{$addToSet: '$headers.To'}}}, {$unwind:"$to"
|
}, {$project:{_id:0,from:"$_id.from",to:1}}, {$group:{_id:{from:"$from",to:"$to"
|
},count:{$sum:1}}}, {$sort:{"count":-1}} ]).explain();
|
It came back after full 13 seconds complaining that there is a syntax errorL
2015-07-14T05:59:44.438-0400 E QUERY TypeError: Object #<Object> has no method 'explain'
at (shell):1:271
m101:PRIMARY>
In my opinion validity of the query should be checked first before actually executing the query. Here it seems to have executed the query and then tried to execute the unavailable "explain" method which makes it look like an expensive mistake.
Apologies if similar jira already exists or if this is filed under wrong project.