MongoDB's indexes are B-Trees.
Lookups (queries), inserts and deletes happen in O(log(n)) time.
TODO: Add a page describing what a B-Tree is???
So this is helpful, and can speed up queries by a tremendous amount
unique applies a uniqueness constant on duplicate values.
dropDups will force the server to create a unique index by only keeping the first document found in natural order with a value and dropping all other documents with that value.
dropDups will likely result in data loss!!! Make sure you know what it does before you use it.
MongoDB doesn't enforce a schema – documents are not required to have the same fields.
Sparse indexes only contain entries for documents that have the indexed field.
Without sparse, documents without field 'a' have a null entry in the index for that field.
With sparse a unique constraint can be applied to a field not shared by all documents. Otherwise multiple 'null' values violate the unique constraint.
cursor – the type of cursor used. BasicCursor means no index was used. TODO: Use a real example here instead of made up numbers…
n – the number of documents that match the query
nscannedObjects – the number of documents that had to be scanned
nscanned – the number of items (index entries or documents) examined
millis – how long the query took
Ratio of n to nscanned should be as close to 1 as possible.
cursor – the type of cursor used. BasicCursor means no index was used. TODO: Use a real example here instead of made up numbers…
n – the number of documents that match the query
nscannedObjects – the number of documents that had to be scanned
nscanned – the number of items (index entries or documents) examined
millis – how long the query took
Ratio of n to nscanned should be as close to 1 as possible.
Indexes should be contained in working set.
From mainframes, to RAC Oracle servers... People solved problems by adding more resources to a single machine.
Large scale operation can be combined with high performance on commodity hardware through horizontal scaling
Build
- Document oriented database maps perfectly to object oriented languages
Scale
- MongoDB presents clear path to scalability that isn't ops intensive
- Provides same interface for sharded cluster as single instance