![](/img/trans.png)
[英]Identifier already declared - Identifier 'userScore' has already been declared
[英]identifier mongoose has already been declared
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});
const Lerischema=new mongoose.Schema({
title:String,
nickname:String,
length:Number
})
const Leri=mongoose.model('Leri',Lerischema)
/* const Lerilr= new Leri({title:'dasi',nickname:'ernesto',length:18})
*/
Leri.insertMany([
{title:'hirti',nickname:'lix',length:5},
{ title:'gero',nickname:'bivre',length:41},
{ title:'herti',nickname:'mengo',length:12}
])
所以这是我使用 mongoose 的代码,在终端中我不断在终端(cmder)中收到此标识符错误,我不知道到底是什么问题
也许你应该看看你是否定义了两个'const mongoose = require ('mongoose')。 我已经解决了这个解决方案(虽然马上还有其他问题)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.