Mongoose
đź’™Mongoose provides a
straight-forward, schema-based solution to model your application data.
It includes built-in type casting, validation, query building, business
logic hooks and more, out of the box.
đź’™Mongoose
acts as a front end to MongoDB, an open source NoSQL database that uses
a document-oriented data model. A “collection” of “documents”, in a
MongoDB database, is analogous to a “table” of “rows” in a relational
database.
why we wrote Mongoose
var mongoose= require ('mongoose');
mongoose.connect('mongodb://localhost/test');
var cat = mongoose.model('cat', {name: string});
var kitty = new Cat({ name: 'Zildjian' });
kitty.save(function (err) {
if (err) {
console.log(err);
} else {
console.log('meow');
}
});
No comments:
Post a Comment