I get the mongo error exceeded memory limit
with error code 16819
when I use aggregation sort.
Im using mongo 2.6.
The query is as follows:
db.BASE_TABLE_CREATION_ExecuteHiveScript_26_V0.aggregate([
{ "$project" : { "visitor_localdate" : 1 , "_id" : 0}},
{ "$sort" : { "visitor_localdate" : -1}}
])
By default aggregation in MongoDB occurs in memory and pipeline stages have limit of 100 Mb RAM. Looks like you have exceeded this threshold. To handle large dataset you should enable aggregation pipeline stages to write data to temporary files. Use allowDiskUse
option for that:
db.BASE_TABLE_CREATION_ExecuteHiveScript_26_V0.aggregate([
{ "$project" : { "visitor_localdate" : 1 , "_id" : 0}},
{ "$sort" : { "visitor_localdate" : -1}}
], { "allowDiskUse" : true })