One of the amazing things of dealing with a document db is the simple fact that you do not need to care at all of the document db itself, you just put documents and get documents, by id or using a query, and it just works.

Well…it should…unless…

There is a weird default behavior of MongoDB that I do not really like: you can issue a query on a collection without the need to define an index, it just works (I suppose doing some sort of full-collection-scan) and you get documents back as expected, unless the size of the collection overlaps a certain dimension after which an index for that type of query must be defined otherwise an error is raised at query time.

The weird thing is that not being forced to define the index raise its problem only in production after a certain amount of time and maybe only under specific circumstances, making in some scenarios pretty hard to understand why something is not working as expected.

On the other side, RavenDB, fully embracing the “eventually consistent” world requires an index to solve a query and the wonderful (at least at development time) thing is that you do not need to manually define indexes, even if it is highly suggested, but that is another story, because the database engine can deduct (and create if not existing) indexes requirements analyzing the query at runtime.

I don’t like surprises under my feet that’s why I don’t like that specific MongoDB behavior.

.m