tsellstrom / crudnodeproject

0 stars 0 forks source link

Start Using Mongoose, and create a schema model #1

Open jmjones88 opened 6 years ago

jmjones88 commented 6 years ago

So you've gotten a basic exposure to the workings of mongodb.

One big challenge is actually knowing what's being stored in your database (the organization and content). That's why typically we use an ORM (Object-relational mapping) to define our schema so we know what's actually in our database. Otherwise, sharing this amoung multiple developers it's hard to figure out what data actually exists (Especially when dealing with a schemaless database)

var kittySchema = mongoose.Schema({
    name: String
});

This defines that in our Mongo Database, we're going to store an object that contains a name. We can use this information to find objects in our database as needed.

This is on our step to ultimately setting up an api, as Mongoose is the thing I pretty much use on every project.

jmjones88 commented 6 years ago

@tsellstrom I don't think I have the right permissions to assign you, but feel free to assign yourself