こんにちは、次のコードを使用してmongodbに値を挿入しました
var mongoose = require('mongoose');
var db = mongoose.createConnection('mongodb://localhost/TruJuncSVC1');
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function callback () {
console.log('connection opened in Mongodb with SAMPLE TESTING Database')
var schema = new mongoose.Schema({Response: String,Id:String,Name:String,News:String,Details:String});
var SvcOrch = db.model('SvcOrch', schema);
var data = new SvcOrch({ 'Response': 'DailyLoad','Id':'S3000981','Name':'Stears','News':'Mens Boutiques Try New Tactics for Winning Loyal CustomersTradition Finds New Biz in Old Font','Details':'Stears Roebuck and Co. or Stears, is an American chain of department stores,[2] which was founded by Richard Warren Sears and Alvah Curtis Roebuck in the late 19th century. Formerly a component of the Dow Jones Industrial Average, Stears bought out Kmart[3] in early 2005, creating the Stears Holdings Corporation.'});
data.save(function (err) {
if (err) return handleError(err);
// saved!
console.log('\nResponse data saved in MongoDB')
})
});
});
各属性に1つの値を挿入できます.1つの属性に複数の値を保存する必要があります.idには2つまたは3つの値が必要であり、すべての属性に同じことが言えます.さらに先に進む方法についてのアイデアは非常に役立ちます.ありがとうあらかじめ