2018-11-27 mongodb + noejs selec

2020-06-23  本文已影响0人  五大RobertWu伍洋

原因在于 _class 字段 使用 false标注了,删除即可:

    rs = await mongo.toutiaoqueryAll(match, 'tianyi', "campaign_info", conf.mongo.toutiaodb, {
        projection: {
            "_id": false,
"_class": false,
            "id": true,
            "advertiser_id": true,
            "name": true,
        }
    });
 express:router dispatching GET /navigateInfo?adverid=103780292228 +0ms
  cpctest match:{"adverid":103780292228} +2ms
(node:94336) UnhandledPromiseRejectionWarning: MongoError: Projection cannot have a mix of inclusion and exclusion.
    at queryCallback (F:\nodejs\node_global\node_modules\mongodb\node_modules\mongodb-core\lib\cursor.js:248:25)
    at F:\nodejs\node_global\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:532:18
    at process._tickCallback (internal/process/next_tick.js:61:11)
(node:94336) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an
async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:94336) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
上一篇下一篇

猜你喜欢

热点阅读