I'm a newbie in mongoDB, and I just would like to ask a simple question. In creating tables in MongoDB, do you go ahead in MongoDB compass and create the fields in a collection, or is there a command where you can generate the table fields declared in the model just like Laravel's php artisan migrate?


You can set up schema validation to enforce what field names are permitted/required, see https://docs.mongodb.com/manual/core/schema-validation/#schema-validation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.