These are chat archives for Automattic/mongoose

20th
Apr 2016
Christoph Werner
@codepunkt
Apr 20 2016 07:05
I'm able to call a Model's constructor without parameters const tenant = new Tenant()
But i'm not able to create without parameters const tenant = await Tenant.create()
Instead, i have to add at least an empty object there const tenant = await Tenant.create({})
Why?
Vlado Tesanovic
@vladotesanovic
Apr 20 2016 07:27
@gonsfx const tenant = new Tenant() create new object of Tenant model, which will you add to database ( probably )
@gonsfx Tenant.create() is function for creating ( inserting ) document in database ( if they are valid ). Same as mongo.insert
Vlado Tesanovic
@vladotesanovic
Apr 20 2016 14:54
Are anyone use mongoose typings, or he/she is interested in updating them? ( current version of mongoose is 4.4.x , typings are 3.8.x )
Eugenio Arosteguy
@euginio
Apr 20 2016 14:56
Hi guys, do you know if exist something for auto generates CRUD methods for defined schemas?
Vlado Tesanovic
@vladotesanovic
Apr 20 2016 15:01
@euginio People here share this library https://github.com/florianholzapfel/express-restify-mongoose
LeonineKing1199
@LeonineKing1199
Apr 20 2016 15:10
Ooh, Express REST and Mongoose, sounds like a good date ;)
Eugenio Arosteguy
@euginio
Apr 20 2016 15:14
hahaha
@vladotesanovic I'm analyzing to use yeoman. Do you know in wich aspects the approach you share is better ?
Vlado Tesanovic
@vladotesanovic
Apr 20 2016 16:43
@euginio I didn't understand you. You want to create generator for RESTful mongoose?
Eugenio Arosteguy
@euginio
Apr 20 2016 17:12
yes, I wanna generate the CRUD code for rest services and the corresponding mongo accesses...
I think restify is a possible approach and yeoman is another
possible
Pier-Luc Gagnon
@Nepoxx
Apr 20 2016 17:23
I don't understand you either. What is it do you have and what is it do you want
Eugenio Arosteguy
@euginio
Apr 20 2016 19:38
hahaha, in Symfony, Django and Ruby on Rails (among others) you have "admin generators" or "crud generators" those generators.... generates automatically code from your model (ui, routes, services, db access, and all the stuff)
I'm searching some similar for the mean stack. Do you understand ?
Pier-Luc Gagnon
@Nepoxx
Apr 20 2016 20:33
So you have Mongoose models and you want a CRUD api generated from those
Vlado Tesanovic
@vladotesanovic
Apr 20 2016 21:31
@euginio ok, you wan't to have UI for generated model ( to be able to preform CRUD operations ) ? I didn't saw such a thing for Mongoose, or neither for NodeJS in general.