Skip to main content

Posts

Showing posts from May, 2017

Mongoose

Question : What Mongoose is all about? Answer : Mongoose is an object modeling tool for MongoDB and Node.js. What this means in practical terms is that you can define your data model in just one place, in your code. Question : Give the example of the basic schema? Answer : This schema defines the name of each item of data, and the type of data, whether it is a string, number, date, Boolean, and so on. var userSchema = new mongoose . Schema ({     name : String ,     email : String ,     createdOn : Date ,      verified : Boolean }) ; In most scenarios you would have one schema for each collection within the database. Schemas are a powerful aspect of Mongoose, which can also be extended with helper functions and additional methods. But we'll describe more about that in a later chapter. Question : What Mongoose is not ideally suited for? Answer : Mongoose is probably not the answer for you if you are primarily working w...