Does Mongoose support the Mongodb `findAndModify` method?

The feature is not well (read: at all) documented, but after reading through the source code, I came up with the following solution. Create your collection schema. var Counters = new Schema({ _id: String, next: Number }); Create a static method on the schema which will expose the findAndModify method of the model’s collection. Counters.statics.findAndModify … Read more

understand MongoDB cache system

Note: This was written back in 2013 when MongoDB was still quite young, it didn’t have the features it does today, while this answer still holds true for mmap, it does not for the other storage technologies MongoDB now implements, such as WiredTiger, or Percona. A good place to start to understand exactly what is … Read more

Sorting on Multiple fields mongo DB

The MongoDB query optimizer works by trying different plans to determine which approach works best for a given query. The winning plan for that query pattern is then cached for the next ~1,000 queries or until you do an explain(). To understand which query plans were considered, you should use explain(1), eg: db.col.find({category:’A’}).sort({updated: -1}).explain(1) The … Read more

How to choose between Cassandra, Membase, Hadoop, MongoDB, RDBMS etc.? [closed]

EDIT The NoSQL Ecosystem by Adam Marcus (from the book The Architecture of open source applications): http://www.aosabook.org/en/nosql.html general thoughts and comparison http://www.thoughtworks.com/articles/nosql-comparison technical comparison http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis a Master’s Thesis – Analysis and Classification of NoSQL Databases http://scholar.googleusercontent.com/scholar?q=cache:rQlbiz6bojAJ:scholar.google.com/+comparison+of+nosql&hl=en&as_sdt=0,5&as_vis=1

Storing a graph in mongodb

Specialized Distributed Graph Databases I know this is sounds a little far afield from the OPs question about Mongo, but these days there are more specialized graph databases that excel at this kind of work and may be much easier for you to use, especially on large graphs. There is a comparison of 7 such … Read more

How to load 100 million records into MongoDB with Scala for performance testing?

Some tips : Do not index your collection before inserting, as inserts modify the index which is an overhead. Insert everything, then create index . instead of “save” , use mongoDB “batchinsert” which can insert many records in 1 operation. So have around 5000 documents inserted per batch. You will see remarkable performance gain . … Read more