SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
Mongoose: MongoDB object
modelling for Node.js

Speaker: Yuriy Bogomolov
Solution Engineer at Sitecore Ukraine
@YuriyBogomolov | fb.me/yuriy.bogomolov
Agenda
1. Short intro: what is Node.js.
2. Main inconveniences of using the native MongoDB driver for Node.js.
3. Mongoose: what is it and what are its killer features:
•
•
•
•
•
•

Validation
Casting
Encapsulation
Middlewares (lifecycle management)
Population
Query building

4. Schema-Driven Design for your applications.
5. Useful links and Q&A
03.03.2014

MongoDB Meetup Dnipropetrovsk

2 /16
1. Intro to Node.js
• Node.js is a server-side JavaScript execution
environment.
• Uses asynchronous event-driven model.
• Major accent on non-blocking operations for
I/O and DB access.
• Based on Google’s V8 Engine.
• Open-source
• Has own package management system — NPM.
• Fast, highly scalable, robust environment.
03.03.2014

MongoDB Meetup Dnipropetrovsk

3 /16
2. Main inconveniences of native MongoDB driver
• No data validation
• No casting during inserts
• No encapsulation
• No references (joins)

03.03.2014

MongoDB Meetup Dnipropetrovsk

4 /16
3. What is Mongoose
• Object Data Modelling (ODM) for Node.js
• Officially supported by 10gen, Inc.
• Features:
•
•
•
•
•

Async and sync validation of models
Model casting
Object lifecycle management (middlewares)
Pseudo-joins!
Query builder

npm install mongoose

03.03.2014

MongoDB Meetup Dnipropetrovsk

5 /16
3. Mongoose setup
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/mycollection');
var Schema = mongoose.Schema;
var PostSchema = new Schema({
title: { type: String, required: true },
body: { type: String, required: true },
author: { type: ObjectId, required: true, ref: 'User' },
tags: [String],
date: { type: Date, default: Date.now }
});

Reference
Simplified declaration
Default value

mongoose.model('Post', PostSchema);

03.03.2014

Validation of presence

MongoDB Meetup Dnipropetrovsk

6 /16
3. Mongoose features: validation
Simplest validation example: presence
var UserSchema = new Schema({ name: { type: String, required: true } });
var UserSchema = new Schema({ name: { type: String, required: 'Oh snap! Name is required.' } });

Passing validation function:
var UserSchema = new Schema({ name: { type: String, validator: validate } });
var validate = function (value) { /*...*/ }; // synchronous validator
var validateAsync = function (value, respond) { respond(false); }; // async validator

Via .path() API call:
UserSchema.path('email').validate(function (email, respond) {
var User = mongoose.model('User');
User.find({ email: email }).exec(function (err, users) {
return respond(!err && users.length === 0);
});
}, 'Such email is already registered');
03.03.2014

MongoDB Meetup Dnipropetrovsk

7 /16
3. Mongoose features: casting
• Each property is cast to its
mapped SchemaType in the
document, obtained by the query.
• Valid SchemaTypes are:
•
•
•
•
•
•
•
•

String
Number
Date
Buffer
Boolean
Mixed
ObjectId
Array

03.03.2014

var PostSchema = new Schema({
_id: ObjectId, // implicitly exists
title: { type: String, required: true },
body: { type: String, required: true },
author: { type: ObjectId, required: true, ref: 'User' },
tags: [String],
date: { type: Date, default: Date.now },
is_featured: { type: Boolean, default: false }
});

MongoDB Meetup Dnipropetrovsk

8 /16
3. Mongoose features: encapsulation
Models can have static methods and instance methods:
PostSchema.statics = {
dropAllPosts: function (areYouSure) {
// drop the posts!
}
};

03.03.2014

PostSchema.methods = {
addComment: function (user, comment,
callback) {
// add comment here
},
removeComment: function (user,
comment, callback) {
// remove comment here
}
};

MongoDB Meetup Dnipropetrovsk

9 /16
3. Mongoose features: lifecycle management
Models have .pre() and .post() middlewares, which can hook custom
functions to init, save, validate and remove model methods:
schema.pre('save', true, function (next, done) {
// calling next kicks off the next middleware in parallel
next();
doAsync(done);
});

schema.post('save', function (doc) {
console.log('%s has been saved', doc._id);
});

03.03.2014

MongoDB Meetup Dnipropetrovsk

10 /16
3. Mongoose features: population
Population is the process of automatically replacing the specified paths
in the document with document(s) from other collection(s):
PostSchema.statics = {
load: function (permalink, callback) {
this.findOne({ permalink: permalink })
.populate('author', 'username avatar_url')
.populate('comments', 'author body date')
.exec(callback);
}
};

03.03.2014

MongoDB Meetup Dnipropetrovsk

11 /16
3. Mongoose features: query building
Different methods could be stacked one upon the other, but the query
itself will be generated and executed only after .exec():
var options = {
perPage: 10,
page: 1
};
this.find(criteria)
.populate('author', 'username')
.sort({'date_published': -1})
.limit(options.perPage)
.skip(options.perPage * options.page)
.exec(callback);

03.03.2014

MongoDB Meetup Dnipropetrovsk

12 /16
4. Schema-Driven Design for your applications
• Schemas should match data-access patterns of your
application.
• You should pre-join data where it’s possible (and use Mongoose’s
.populate() wisely!).
• You have no constraints and transactions — keep that in mind.
• Using Mongoose for designing your application’s Schemas is similar to
OOP design of your code.

03.03.2014

MongoDB Meetup Dnipropetrovsk

13 /16
Useful links
• Node.js GitHub repo: https://github.com/joyent/node
• Mongoose GitHub repo: https://github.com/learnboost/mongoose
• Mongoose API docs and tutorials: http://mongoosejs.com/
• MongoDB native Node.js driver docs:
http://mongodb.github.io/node-mongodb-native/

03.03.2014

MongoDB Meetup Dnipropetrovsk

14 /16
Any questions?

03.03.2014

MongoDB Meetup Dnipropetrovsk

15 /16
MongoDB Meetup Dnipropetrovsk

Mais conteúdo relacionado

Mais procurados

mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교
Woo Yeong Choi
 

Mais procurados (20)

An Enterprise Architect's View of MongoDB
An Enterprise Architect's View of MongoDBAn Enterprise Architect's View of MongoDB
An Enterprise Architect's View of MongoDB
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
 
MongoDB Atlas
MongoDB AtlasMongoDB Atlas
MongoDB Atlas
 
Solid NodeJS with TypeScript, Jest & NestJS
Solid NodeJS with TypeScript, Jest & NestJSSolid NodeJS with TypeScript, Jest & NestJS
Solid NodeJS with TypeScript, Jest & NestJS
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mongo db intro.pptx
Mongo db intro.pptxMongo db intro.pptx
Mongo db intro.pptx
 
Uploading certificate with oracle wallet manager and orapki utilities
Uploading certificate with oracle wallet manager and orapki utilitiesUploading certificate with oracle wallet manager and orapki utilities
Uploading certificate with oracle wallet manager and orapki utilities
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
Amazon Aurora Deep Dive (김기완) - AWS DB Day
Amazon Aurora Deep Dive (김기완) - AWS DB DayAmazon Aurora Deep Dive (김기완) - AWS DB Day
Amazon Aurora Deep Dive (김기완) - AWS DB Day
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
 
Open Liberty: オープンソースになったWebSphere Liberty
Open Liberty: オープンソースになったWebSphere LibertyOpen Liberty: オープンソースになったWebSphere Liberty
Open Liberty: オープンソースになったWebSphere Liberty
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDB
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
 
mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
Introduction to elasticsearch
Introduction to elasticsearchIntroduction to elasticsearch
Introduction to elasticsearch
 

Semelhante a Mongoose: MongoDB object modelling for Node.js

540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf
hamzadamani7
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
Mohammad Qureshi
 

Semelhante a Mongoose: MongoDB object modelling for Node.js (20)

Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosAngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf
 
TestWorks conf Dry up your angularjs unit tests using mox - Mike Woudenberg
TestWorks conf Dry up your angularjs unit tests using mox - Mike WoudenbergTestWorks conf Dry up your angularjs unit tests using mox - Mike Woudenberg
TestWorks conf Dry up your angularjs unit tests using mox - Mike Woudenberg
 
AngularJS
AngularJSAngularJS
AngularJS
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
A Story about AngularJS modularization development
A Story about AngularJS modularization developmentA Story about AngularJS modularization development
A Story about AngularJS modularization development
 
MEAN - Notes from the field (Full-Stack Development with Javascript)
MEAN - Notes from the field (Full-Stack Development with Javascript)MEAN - Notes from the field (Full-Stack Development with Javascript)
MEAN - Notes from the field (Full-Stack Development with Javascript)
 
NodeJS and ExpressJS.pdf
NodeJS and ExpressJS.pdfNodeJS and ExpressJS.pdf
NodeJS and ExpressJS.pdf
 
Building a scalable web application by combining modern front-end stuff and A...
Building a scalable web application by combining modern front-end stuff and A...Building a scalable web application by combining modern front-end stuff and A...
Building a scalable web application by combining modern front-end stuff and A...
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
node.js.pptx
node.js.pptxnode.js.pptx
node.js.pptx
 
Building Web Apps with Express
Building Web Apps with ExpressBuilding Web Apps with Express
Building Web Apps with Express
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Back to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBBack to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDB
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.js
 
20120816 nodejsdublin
20120816 nodejsdublin20120816 nodejsdublin
20120816 nodejsdublin
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Mongoose: MongoDB object modelling for Node.js

  • 1. Mongoose: MongoDB object modelling for Node.js Speaker: Yuriy Bogomolov Solution Engineer at Sitecore Ukraine @YuriyBogomolov | fb.me/yuriy.bogomolov
  • 2. Agenda 1. Short intro: what is Node.js. 2. Main inconveniences of using the native MongoDB driver for Node.js. 3. Mongoose: what is it and what are its killer features: • • • • • • Validation Casting Encapsulation Middlewares (lifecycle management) Population Query building 4. Schema-Driven Design for your applications. 5. Useful links and Q&A 03.03.2014 MongoDB Meetup Dnipropetrovsk 2 /16
  • 3. 1. Intro to Node.js • Node.js is a server-side JavaScript execution environment. • Uses asynchronous event-driven model. • Major accent on non-blocking operations for I/O and DB access. • Based on Google’s V8 Engine. • Open-source • Has own package management system — NPM. • Fast, highly scalable, robust environment. 03.03.2014 MongoDB Meetup Dnipropetrovsk 3 /16
  • 4. 2. Main inconveniences of native MongoDB driver • No data validation • No casting during inserts • No encapsulation • No references (joins) 03.03.2014 MongoDB Meetup Dnipropetrovsk 4 /16
  • 5. 3. What is Mongoose • Object Data Modelling (ODM) for Node.js • Officially supported by 10gen, Inc. • Features: • • • • • Async and sync validation of models Model casting Object lifecycle management (middlewares) Pseudo-joins! Query builder npm install mongoose 03.03.2014 MongoDB Meetup Dnipropetrovsk 5 /16
  • 6. 3. Mongoose setup var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost:27017/mycollection'); var Schema = mongoose.Schema; var PostSchema = new Schema({ title: { type: String, required: true }, body: { type: String, required: true }, author: { type: ObjectId, required: true, ref: 'User' }, tags: [String], date: { type: Date, default: Date.now } }); Reference Simplified declaration Default value mongoose.model('Post', PostSchema); 03.03.2014 Validation of presence MongoDB Meetup Dnipropetrovsk 6 /16
  • 7. 3. Mongoose features: validation Simplest validation example: presence var UserSchema = new Schema({ name: { type: String, required: true } }); var UserSchema = new Schema({ name: { type: String, required: 'Oh snap! Name is required.' } }); Passing validation function: var UserSchema = new Schema({ name: { type: String, validator: validate } }); var validate = function (value) { /*...*/ }; // synchronous validator var validateAsync = function (value, respond) { respond(false); }; // async validator Via .path() API call: UserSchema.path('email').validate(function (email, respond) { var User = mongoose.model('User'); User.find({ email: email }).exec(function (err, users) { return respond(!err && users.length === 0); }); }, 'Such email is already registered'); 03.03.2014 MongoDB Meetup Dnipropetrovsk 7 /16
  • 8. 3. Mongoose features: casting • Each property is cast to its mapped SchemaType in the document, obtained by the query. • Valid SchemaTypes are: • • • • • • • • String Number Date Buffer Boolean Mixed ObjectId Array 03.03.2014 var PostSchema = new Schema({ _id: ObjectId, // implicitly exists title: { type: String, required: true }, body: { type: String, required: true }, author: { type: ObjectId, required: true, ref: 'User' }, tags: [String], date: { type: Date, default: Date.now }, is_featured: { type: Boolean, default: false } }); MongoDB Meetup Dnipropetrovsk 8 /16
  • 9. 3. Mongoose features: encapsulation Models can have static methods and instance methods: PostSchema.statics = { dropAllPosts: function (areYouSure) { // drop the posts! } }; 03.03.2014 PostSchema.methods = { addComment: function (user, comment, callback) { // add comment here }, removeComment: function (user, comment, callback) { // remove comment here } }; MongoDB Meetup Dnipropetrovsk 9 /16
  • 10. 3. Mongoose features: lifecycle management Models have .pre() and .post() middlewares, which can hook custom functions to init, save, validate and remove model methods: schema.pre('save', true, function (next, done) { // calling next kicks off the next middleware in parallel next(); doAsync(done); }); schema.post('save', function (doc) { console.log('%s has been saved', doc._id); }); 03.03.2014 MongoDB Meetup Dnipropetrovsk 10 /16
  • 11. 3. Mongoose features: population Population is the process of automatically replacing the specified paths in the document with document(s) from other collection(s): PostSchema.statics = { load: function (permalink, callback) { this.findOne({ permalink: permalink }) .populate('author', 'username avatar_url') .populate('comments', 'author body date') .exec(callback); } }; 03.03.2014 MongoDB Meetup Dnipropetrovsk 11 /16
  • 12. 3. Mongoose features: query building Different methods could be stacked one upon the other, but the query itself will be generated and executed only after .exec(): var options = { perPage: 10, page: 1 }; this.find(criteria) .populate('author', 'username') .sort({'date_published': -1}) .limit(options.perPage) .skip(options.perPage * options.page) .exec(callback); 03.03.2014 MongoDB Meetup Dnipropetrovsk 12 /16
  • 13. 4. Schema-Driven Design for your applications • Schemas should match data-access patterns of your application. • You should pre-join data where it’s possible (and use Mongoose’s .populate() wisely!). • You have no constraints and transactions — keep that in mind. • Using Mongoose for designing your application’s Schemas is similar to OOP design of your code. 03.03.2014 MongoDB Meetup Dnipropetrovsk 13 /16
  • 14. Useful links • Node.js GitHub repo: https://github.com/joyent/node • Mongoose GitHub repo: https://github.com/learnboost/mongoose • Mongoose API docs and tutorials: http://mongoosejs.com/ • MongoDB native Node.js driver docs: http://mongodb.github.io/node-mongodb-native/ 03.03.2014 MongoDB Meetup Dnipropetrovsk 14 /16