Mongoose’s Performance in Stored Procedures

  node.js, question

Directly above
图片描述
图片描述
Why can’t I respond all the time when I use mongoose to store the data, and Color Defense all the time when I fill up the data …
Can I save it in seconds when I don’t fill in the form?
The following are the stored results
图片描述
The following is the model

var AssetSave = new mongoose.Schema({
 assetsName:String,
 assetsNum:Number,
 assetsDepart:String,
 inTime:Date,
 assetsUse:String,
 assetsGG:String,
 assetsDW:String,
 assetsXH:String,
 assetsQuery:String,
 assetsBuyTime:Date,
 assetsSaveLoc:String,
 assetsProLoc:String,
 assetsNote:String,
 date:{
 type:Date,
 default:Date.now()
 bracket
 });

图片描述

The following is an example

var datas = req.body.datas;
 // res.json({data:1});
 console.log('---------------------')
 console.log(datas.assetsName)
 console.log('---------------------')
 var _AssetSave = new AssetSave({
 assetsName:datas.assetsName,
 assetsNum:datas.assetsNum,
 assetsDepart:datas.assetsDepart,
 inTime:datas.inTime,
 assetsUse:datas.assetsUse,
 assetsGG:datas.assetsGG,
 assetsDW:datas.assetsDW,
 assetsXH:datas.assetsXH,
 assetsQuery:datas.assetsQuery,
 assetsBuyTime:datas.assetsBuyTime,
 assetsSaveLoc:datas.assetsSaveLoc,
 assetsProLoc:datas.assetsProLoc,
 assetsNote:datas.assetsNote
 });
 _AssetSave.save(function (err,assets) {
 if(err){
 return false;
 bracket
 res.json({data:1});
 })

It may be that the data type is incorrect, and then err is reported. However, you do not have res.json () in err, resulting in no response. You can print err and take a look.