12. MONGOOSE V3
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
-- Tim Peters, The Zen of Python http://www.python.org/dev/peps/pep-0020/
13. MONGOOSE V3
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
There should be one--
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
and preferably only one
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
--obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
-- Tim Peters, The Zen of Python http://www.python.org/dev/peps/pep-0020/
51. MONGOOSE V3
Missing MongoDB features
•FindAndModify
// old way
var o = { _id: anObjectId }
Talks.findOne(o, function (err, doc) {
doc.name = ‘peanut butter’;
doc.save()
})
52. MONGOOSE V3
Missing MongoDB features
•FindAndModify
// new way
var o = { _id: anObjectId }
, up = { $set: { name: ‘peanut butter’}}
Talks.findOneAndUpdate(o, up, function (err, doc) {
console.log(doc)
})
53. MONGOOSE V3
Missing MongoDB features
•FindAndModify
var o = { name: ‘peanut butter’ }
Talks.findOneAndRemove(o, function (err, res) {
console.log(res)
})
MongoDB is an open source, document-oriented database.\nInstead of storing your data in tables and rows as you would with a relational database, MongoDB lets you store JSON-like documents. \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
falls flat on its face\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Argentina you eat the whole cow.\nWe want the whole MongoDB cow.\n
Argentina you eat the whole cow.\nWe want the whole MongoDB cow.\n
\n
return results\n
return a model instance\n
\n
\n
\n
\n
\n
circular buffer\nTTL collections\n
MongoDB 2.2\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
query.stream()\n
\n
\n
\n
no idea what needs to be done\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
2 approaches - hit db with two operations or just one\n