MongoDB will only return sorted results on fields without an index if the sort operation uses less than 32 megabytes of memory.
Hi All,We are using vaadin lazy loading table with mangodb. At the time of doing pagination, in some specific skip and size critria, it is throwing above error and most of cases it is working good. We have the indexes for the cololectiion as well. Please find below logs:Query we usedcursor = collection.find(query).skip(skip).limit(size).sort(
new BasicDBObject(SearchConstants.FIELD_REQUEST_ID,"requestId").append(SearchConstants.
FIELD_IE_SERIES,"ie_series"));LOGScom.mongodb.MongoException: too much data for sort() with no index. add an index or specify a smaller limit
at com.mongodb.MongoException.parse(MongoException.java:82)
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:312)
at com.mongodb.DBCursor._check(DBCursor.java:369)
at com.mongodb.DBCursor._hasNext(DBCursor.java:504)
at com.mongodb.DBCursor.hasNext(DBCursor.java:529)
at com.honeywell.htt.tdc.dao.mongo.TestDataDAOImpl.find(TestDataDAOImpl.java:127)
at com.honeywell.htt.tdc.delegate.SearchDelegate.findWithFilters(SearchDelegate.java:103)
at com.honeywell.htt.tdc.utils.SearchQueryFactory.getResult(SearchQueryFactory.java:136)
at com.honeywell.htt.tdc.utils.SearchQuery.loadItems(SearchQuery.java:60)
at org.vaadin.addons.lazyquerycontainer.LazyQueryView.queryItem(LazyQueryView.java:233)
at org.vaadin.addons.lazyquerycontainer.LazyQueryView.getItem(LazyQueryView.java:211)
at org.vaadin.addons.lazyquerycontainer.LazyQueryContainer.getItem(LazyQueryContainer.java:176)
at com.jensjansson.pagedtable.PagedTableContainer.getItem(PagedTableContainer.java:70)
at com.vaadin.ui.AbstractSelect.getItem(AbstractSelect.java:681)
at com.honeywell.htt.tdc.search.results.PerformanceTestSearchResult$2.generateCell(PerformanceTestSearchResult.java:311)
at com.honeywell.htt.tdc.search.results.PerformanceTestSearchResult$2.generateCell(PerformanceTestSearchResult.java:1)
at com.vaadin.ui.Table.getVisibleCellsNoCache(Table.java:1840)
at com.vaadin.ui.Table.refreshRenderedCells(Table.java:1477)
at com.vaadin.ui.Table.refreshRowCache(Table.java:2182)
at com.vaadin.ui.Table.containerItemSetChange(Table.java:3858)
at com.jensjansson.pagedtable.PagedTable.setPageFirstIndex(PagedTable.java:251)
at com.jensjansson.pagedtable.PagedTable.setCurrentPage(PagedTable.java:309)
at com.jensjansson.pagedtable.PagedTable$6.buttonClick(PagedTable.java:139)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
Thanks Adam.It is properly indexed for two fields and result also properly mapped with objects.It is working sometime and failing for some specific records. But i couldn't find anything wrong on those documents.Few time it is working for all documents as well. Please share if you have any idea on this behaviour and i didn't have any clue on this.
Could you be hitting the 16 mb document limit? Just a thought.
--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/z8tucW0nwxE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
I think there is a 16 mb limit for results to fit in. For aggregation queries I am certain. For sorting I am not sure.
MongoDB will only return sorted results on fields without an index if the sort operation uses less than 32 megabytes of memory.
$sort produces an error if the operation consumes 10 percent or more of RAM.
Did you read that I'm using an index and so this limitation is not apllying to my case?