E:\nodejs\lianxi\blog\node_modules\mongodb\lib\mongodb\connection\base.js:245 throw message; ^ TypeError: Cannot call method ‘slice’ of null at convert_tree_to_html (E:\nodejs\lianxi\blog\node_modules\markdown\lib\markdown.js:1556:21) at Object.toHTMLTree (E:\nodejs\lianxi\blog\node_modules\markdown\lib\markdown.js:112:14) at Object.toHTML (E:\nodejs\lianxi\blog\node_modules\markdown\lib\markdown.js:82:22) at E:\nodejs\lianxi\blog\models\post.js:74:26 at Array.forEach (native) at E:\nodejs\lianxi\blog\models\post.js:73:10 at E:\nodejs\lianxi\blog\node_modules\mongodb\lib\mongodb\cursor.js:163:16 at commandHandler (E:\nodejs\lianxi\blog\node_modules\mongodb\lib\mongodb\cursor.js:709:16) at E:\nodejs\lianxi\blog\node_modules\mongodb\lib\mongodb\db.js:1846:9 at Server.Base._callHandler (E:\nodejs\lianxi\blog\node_modules\mongodb\lib\mongodb\connection\base.j s:445:41) 下边是我的代码: collection.find(query).sort({time:-1}).toArray(function(err,docs){ mongodb.close(); if(err){ return callback(err); } 73 docs.forEach(function(doc){ 74 doc.post = markdown.toHTML(doc.post); }); callback(null,docs);//成功,已数组返回查询结果
作者
作者其它话题