Tip : count is incorrect if used with limit in mongoid
Database : Mongodb
campaigns = Campaign.limit(1000)
I was expecting count as 1000 for second query, but it came out to be same as first one. But actual objects stored in campaigns array are 1000 as it gives nil for 1001st index.
I spend quite some time while writing program to figure out this. I don’t have answer to this. This works correct if your database is mysql or postgres.
Someone may give answer to this and someone will save time in figuring it out.