Mongo - 类型为NumberLong时不返回数据

时间:2017-03-27 07:18:07

标签: node.js mongodb mongoose

我正在使用mongoose和nodejs来查询数据库中的数据,我在数据库中的数据如下,其中包含以下userId:

enter image description here

代码:

 return dbService.query(userModel, {
                        'userId': idRetrieved
                    }, {});

查询方法的实现:

 query: function (model, conditon, options) {
            console.log(conditon, options);
            return new Promise(function (resolve, reject) {
                options = options || {};

                model.find(conditon, {}, options).exec(function (error, data) {
                    if (error) {                       
                        reject(error);
                    }
                    resolve(data);
                })
            })
        }

模式

var userToSchema = dbService.createEntityDef({
            userId: {
                type: Number
            },

            firstName: {
                type: String
            },
            lastName: {
                type: String
            },
            urlPicture: {
                type: String
            }

        });

以上不会返回任何数据。

0 个答案:

没有答案