MongoDB中的模式数据保存在哪里?
我正在用Mongoose保存一些数据,但不确定保存在哪里。MongoDb中的数据保存在哪里?在哪一个表或集合中MongoDB中的模式数据保存在哪里?,mongodb,mongoose,Mongodb,Mongoose,我正在用Mongoose保存一些数据,但不确定保存在哪里。MongoDb中的数据保存在哪里?在哪一个表或集合中 var Chat = mongoose.model('Chat', ChatSchema); console.log('Message Received: ', msg); var data = [{ sent: new Date(), room: 'General', username: 'Chris', text: msg }] //Loop through ea
var Chat = mongoose.model('Chat', ChatSchema);
console.log('Message Received: ', msg);
var data = [{
sent: new Date(),
room: 'General',
username: 'Chris',
text: msg
}]
//Loop through each of the chat data and insert into the database
for (var c = 0; c < data.length; c++) {
//Create an instance of the chat model
var entry = new Chat(data[c]);
//Call save to insert the chat
entry.save(function(err, savedChat) {
console.log(savedChat);
});
}
var Chat=mongoose.model('Chat',ChatSchema);
log('messagereceived:',msg);
风险值数据=[{
已发送:新日期(),
房间:'将军',
用户名:“克里斯”,
文本:msg
}]
//循环浏览每个聊天数据并插入数据库
对于(var c=0;c
默认情况下,Mongoose通过将模型名称传递给utils.toCollectionName方法来生成集合名称。此方法使名称复数
检查文档:(选项:集合)
在您的情况下,如果连接到数据库,您将看到一个集合:
chats
它应该保存在您在moose中指定的任何集合中