One of RavenDB’s unique features is something called safe by default – this means that the database is configured to stop users querying for large amounts of data which is never a good idea, to have a query return thousands of records is inefficient and can also take a long time.
With RavenDB safe by default limits the number of records by default on the client side to 128 (by default means its configurable) if you don’t make use of Take(). Server side you can use .Take(1024) if you want to go up to the limit configured by the server, if you try to bring back more than 1024 then it will default to 1024 results returned if you need to return more data than that then you should be asking yourself why?, page your data if you need to return more than this number of records.
Safe by default is attempting to stop a developer from writing poor queries, there is nothing to stop you from changing the defaults to a higher level but if you’re looking to display thousands of records on a webpage without paging through your data then this is seen as poor design, here is a nice a quote from the RavenDB website: -
RavenDB will let you shoot yourself in the foot, but only after you make it absolutely clear that this is what you actually want to do
It seems to be quite common for developers to try to work around the limits and actually want to block their leg off, this usually stems from a misunderstanding of how to use RavenDB, it really is a very simple concept which I find to be a nice feature.
RavenDB also had a very useful option to stop yourself from creating the dreaded SELECT N+1 scenario – this feature stops after 30 request to the server per session, again configurable but if you’re hitting this limit then your more than likely querying incorrectly.
To summarise safe by default is there to help and not hinder, yes you’ll write code then realise your only returning 128 records when there should be more results, no doubt everyone has done that whilst using RavenDB, either your unit tests aren’t right or you’ve forgotten to use .Take()