Хорошие я работаю с nodejs, я программировал мой backend в mongodb и чтобы начинаться, верит в schema пользователь, позже я проник в IDE robo3t и присоединился в базу данных personajes
:
Моя проблема приходит далее: я создал мою вторую таблицу позвони персонажи и продолжая те же процессы создания, которое с schema пользователи не создает мне, в этом случае, эту новую таблицу.
Далее я оставляю код:
database.js
const mongoose = require('mongoose');
const URI = 'mongodb://localhost/personajes';
mongoose.connect(URI)
.then( db => console.log('DB is connected'))
.catch(err => console.log(err));
module.exports = mongoose;
usuario.js
const mongoose = require('mongoose');
const {Schema} = mongoose;
const usuarioSchema = new Schema({
nombre_personal :{type: String, required : true},
apel1_personal :{type: String, required : true},
apel2_personal :{type: String, required : true},
pais :{type: String, required : true},
ciudad :{type: String, required : true},
nombre_usuario :{type: String, required : true},
password_usuario :{type: String, required : true},
email_usuario :{type: String, required : true}
});
module.exports = mongoose.model('USUARIOS', usuarioSchema);
personaje.js
const mongoose = require('mongoose');
const {Schema} = mongoose;
const personajeSchema = new Schema({
nombre :{type: String, required : true},
apellidos :{type: String, required : true},
mundo :{type: String, required : true},
lugar_mundo :{type: String, required : true},
raza :{type: String, required : true},
edad :{type: String, required : true},
clase :{type: String, required : true},
oficio :{type: String, required : true},
historia :{type: String, required : true}
});
module.exports = mongoose.model('PERSONAJES', personajeSchema);
'Привет @josanangel,
Мне кажется, что твоя проблема находится в унифицированном указателе ресурса, который ты перемещаешь его в нее conexiГіn MongoDB, что ты не показываешь ему порт: const URI = 'mongodb://localhost:27017/personajes';
По умолчанию, MongoDB выбирает 27017 а ты это изменил в тебе configuraciГіn.
Кроме того, segГєn они imГЎgenes и cГіdigo, который ты показываешь, colecciГіn, что ты пишешь в 'NodeJS', не согласовывается с той, которая у тебя есть в 'ROBO3T', deberГ - чтобы идти в minГєsculas (usuario
).
Надеялся, что он смог помогать тебе в твоей проблеме.
Приветствие