MongoDB Pagination 0.

3
From

Download Link: https://sourceforge.net/projects/mongopagination/

Presented By: Sougata Pal (Skall)
skall.paul@techunits.com November 28, 2011

MongoDB Pagination 0.3
Introduction to MongoDB Pagination MongoDB Pagination is the PHP Pagination tool developed by Techunits and has been used by many of it's partners; e.g. Buzzers.co.za, Trivian Mobile API, CelebRise Network etc. MongoDB Pagination is already been indexed by Mongo team on their official site as follows:
http://www.mongodb.org/display/DOCS/PHP+Libraries%2C+Frameworks%2C+and+Tools

MongoDB Pagination 0.3
Initialize MongoDB Pagination
/* Include MongoDB Pagination Library into your code require_once('MongoPagination/MongoPagination.php'); /* Connect to MongoDB server */ $mongoConn = new Mongo(); $mongoHandler = $mongoConn->testDatabase; /* Initiate MongoDB Pagination Object with MongoConnection Handler $pagination = new MongoPagination($mongoHandler); */ */

Note: Once MongoDB Pagination Object is Initiated you can directly pass MongoDB find(), sort() parameters into it. You wil not require any abstrcted layer to pass through.

MongoDB Pagination 0.3
MongoDB Pagination with Limit
$limit = 20; $pagination->setQuery(array( '#collection' => 'testCollection', '#find' => array( 'key' => 'mykey' ), '#sort' => array( 'created' => -1 ), ), $limit); /* Paginate the result with repect to the parameter you have passed via setQuery() $dataSet = $pagination->Paginate(); Note: The resultset will contain follwing fields witj only limit is passed into setQuery,
$dataset['dataset'] = "ARRAY / STRING - raw data array/string" $dataset['totalItems'] = "INTEGER - total number of documents available with respect to the query"

MongoDB Pagination 0.3
MongoDB Pagination with Limit
$itemsPerPage = 5; $currentPage = 1; $pagination->setQuery(array( '#collection' => 'testCollection', '#find' => array( 'key' => 'mykey' ), '#sort' => array( 'created' => -1 ), ), $currentPage, $itemsPerPage); $dataSet = $pagination->Paginate(); $page_links = $pagination->getPageLinks(); Note: The resultset will contain follwing info,
$dataset['dataset'] = "ARRAY / STRING - raw data array/string" $dataset['totalPages'] = "INTEGER - total pages calculated with respect to $itemsPerPage" $dataset['totalItems'] = "INTEGER - total number of documents available with respect to the query"

MongoDB Pagination 0.3
Thank you for your valuableDevelopers Email: time
skall.paul@techunits.com Community Discussion: techmvc@googlegroups.com Download Link: https://sourceforge.net/projects/mongopagination/