The callback function connection.queryreturns three values, of which the second one is a set of query results and, therefore, an array of values .
Therefore, you should use it result[0], even if you are sure that the result set will contain only one record.
, , , . mysql SELECT ( ) mongodb db.collection.findOne(), ,