小编Vik*_*ngh的帖子

sails.js + npm模块'bcrypt'未在Windows 10中安装

我克隆了一个使用'bcrypt'模块的sails项目,当我尝试使用命令安装它时 -

npm install --save bcrypt  
Run Code Online (Sandbox Code Playgroud)

但它给了我以下错误!!!.我也使用npm版本@ 3.6.0和节点版本@ 5.6.0.Am无法解决此错误如下所示:

 > bcrypt@0.8.5 install C:\Users\vikas\Documents\batua-web\node_modules\bcrypt  
 > node-gyp rebuild  
 > C:\Users\vikas\Documents\batua-web\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.  
 > C:\Users\vikas\Documents\batua-web\node_modules\bcrypt\build\bcrypt_lib.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  
> gyp …
Run Code Online (Sandbox Code Playgroud)

bcrypt node.js npm sails.js npm-install

8
推荐指数
2
解决办法
1829
查看次数

在 mongodb 中保存或更新文档时如何防止更新“updatedAt”字段?

我现在的情况是,我想更新 mongodb 中的集合文档,但我不希望更新“updatedAt”字段。我想保留更新字段的先前值。请帮忙。

mongoose mongodb node.js

6
推荐指数
1
解决办法
4779
查看次数

mongodb 查询带有日期字段的嵌套数组

这是我的文件。

"calendar": {
        "_id": "5cd26a886458720f7a66a3b8",
        "hotel": "5cd02fe495be1a4f48150447",
        "calendar": [
            {
                "_id": "5cd26a886458720f7a66a413",
                "date": "1970-01-01T00:00:00.001Z",
                "rooms": [
                    {
                        "_id": "5cd26a886458720f7a66a415",
                        "room": "5cd17d82ca56fe43e24ae5d3",
                        "price": 10,
                        "remaining": 8,
                        "reserved": 0
                    },
                    {
                        "_id": "5cd26a886458720f7a66a414",
                        "room": "5cd17db6ca56fe43e24ae5d4",
                        "price": 12,
                        "remaining": 8,
                        "reserved": 0
                    },
                 {
                        "_id": "5cd26a886458720f7a66a34",
                        "room": "5cd17db6ca45fe43e24ae5e7",
                        "price": 0,
                        "remaining": 0,
                        "reserved": 0
                    }
                ]
            },
   }
Run Code Online (Sandbox Code Playgroud)

这是我的shema:

const calendarSchema = mongoose.Schema({
    hotel: {
        type: mongoose.Schema.ObjectId,
        ref: "Hotel",
        required: true
    },
    city: {
        type: mongoose.Schema.ObjectId,
        ref: "City"
    },
    calendar: [
        {
            date: …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb mongoose-schema

5
推荐指数
1
解决办法
734
查看次数