Skip to content

Instantly share code, notes, and snippets.

@cranic
Last active December 25, 2015 06:49
Show Gist options
  • Save cranic/6935418 to your computer and use it in GitHub Desktop.
Save cranic/6935418 to your computer and use it in GitHub Desktop.
var mongoose = require('mongoose');
var Agenda = function(usuario){
var schema = new mongoose.Schema({
nome: 'string',
sobrenome: 'string'
});
// O terceiro argumento serve para especificar o nome da collection
return mongoose.model('agenda_' + usuario, schema, 'agenda_' + usuario);
}
module.exports = Agenda;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment