Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongoose without schema

What is currently the 'right' way to insert objects/documents into mongoose without defining a schema?

I have read a few things like this: How do you use Mongoose without defining a schema?

Any ideas

like image 223
lostintranslation Avatar asked Aug 26 '26 18:08

lostintranslation


1 Answers

Mongoose says that you can use a Mixed schema to define a schema-less type. The trade off is that you have to tell mongoose if you modified Mixed Schema value before you call save. Other than that, you should be able to define anything you want in the "schema".

Docs - http://mongoosejs.com/docs/schematypes.html#mixed

like image 74
anthonylawson Avatar answered Aug 28 '26 10:08

anthonylawson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!