Changes do not take effect when I change Schema, using mongodb and nodejs

1

Whenever I make a change in my Schema I have to restart my mongo server or node for the changes to take effect.

I'm using the nodemon, but it does not always update, has anyone ever had it?

module.exports = function(app){
    var Schema = require('mongoose').Schema;

    var localizacao = new Schema({
        name : { type : String, trim : true },
        loc : {
            type : String,
            cordinates : [ String ]
        }
    });

    var funcionamento = new Schema({
        abertura : { type : String, default : '00:00:00' },
        fechamento : { type : String, default : '24:00:00' }
    });

    var agentes = new Schema({
        nome : { type : String, trim : true, require : true, index : { unique : true } },
        senha : { type : String, trim : true, require : true },
        foto : { type : String, trim : true },
        telefone : { type : String, trim : true, max : 20 },
        localizacao : localizacao,
        simulador : { type : Boolean, default : true },     
        funcionamento : funcionamento,
        limites : [],
        nivel : { type : Number, default : 3 },
        visivel : { type : Boolean, default : true }
    }, 
        { timestamps: { createdAt : 'created_at', updatedAt : 'updated_at' } }
    );

    return global.conexao.model('agentes', agentes);
}
    
asked by anonymous 25.07.2017 / 14:46

0 answers