нумерация массивов mongoDB

У меня есть коллекция комментариев с текстом комментария в массиве с его метаданными. Мне нравится разбиение на страницы в текстовом массиве комментариев. Нумерация страниц должна позволить мне получить «предыдущие 5» или "следующие 5". Каков наилучший способ сделать это в mongoDB с хорошей производительностью.

   { "_id" : ObjectId( "502c706ac2e6777781a593f6" ),
      "commentType":"loc",
      "commentList" : [ 
{ "commentText" : "HelloComment",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
{ "commentText" : "2222222",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
{ "commentText" : "3333333",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
{ "commentText" : "44444444",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
{ "commentText" : "5555555",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
{ "commentText" : "6666666",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
    { "commentText" : "777777",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
    { "commentText" : "888888",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
    { "commentText" : "6666666",
  "commentTS" : Date( 1345165636344 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fd182d92b2a87f780c6bbe8" ) } }, 
{ "commentText" : "999999",
  "commentTS" : Date( 1345165668809 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fdeb271de26fd298262bb84" ) } }, 
{ "commentText" : "HelloComment",
  "commentTS" : Date( 1345749858601 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fdeb271de26fd298262bb84" ) } }, 
{ "commentText" : "NewTestforcomments",
  "commentTS" : Date( 1345750020526 ),
  "commentLoc" : { "commentlat" : 0,
    "commentlong" : 0 },
  "userInfo" : { "$ref" : "userProfile",
    "$id" : ObjectId( "4fdeb271de26fd298262bb84" ) } } ],
   } } 

Спасибо за вашу помощь.

Ответы на вопрос(1)

Ваш ответ на вопрос