でドキュメントを取得する方法を、私は、一度に1つのドキュメントを取得したいが、私はそれを取得することができますどのように、長い文字列を除いた文書には何も持っていけませんか?私はすべての文書私は、各文書に長い文字列を持つコレクション内の複数の文書を持っているマングース
var schema = new mongoose.Schema({
question : String,
id: Number
})
var quizz = mongoose.model('Quiz', schema);
var firstDoc = new quizz({
question: 'question 1',
id: 1
})
var secondDoc = new quizz({
question: 'question 2',
id: 2
var question_data = [firstDoc, secondDoc];
quizz.insertMany(question_data, function(err, res){
if(err){
console.log("error occured while saving document object " + err)
}else{
console.log("saved data");
}
})
quizz.findOne({id : '1'}, function(err, res){
if(err){
console.log(err)
}else{
console.log(res);
}
})
'quizz.findOne(関数(ERR、データ){})' –
私は質問 – blackHawk