Your SlideShare is downloading. ×
MongoDB Pagination 0.3
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MongoDB Pagination 0.3

1,791
views

Published on

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 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.

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,791
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. MongoDB Pagination 0.3 From Presented By: Sougata Pal (Skall) [email_address] November 28, 2011 Download Link: https://sourceforge.net/projects/mongopagination/
  • 2. 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
  • 3. 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.
  • 4. 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"
  • 5. 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"
  • 6. MongoDB Pagination 0.3 Thank you for your valuable time Developers Email: [email_address] Community Discussion: [email_address] Download Link: https://sourceforge.net/projects/mongopagination/

×