Server Side Processing MongoDB limit
Server Side Processing MongoDB limit
rrtt22
Posts: 17Questions: 1Answers: 0
http://debug.datatables.net/ikigiq thats the link , can you help me for limiting the displaying rows ??
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
https://datatables.net/reference/option/pageLength
pageLength doesn't work at server side , at client side that's work.
im using this JavaScript
"processing" : true,
"serverSide" : true,
at that script page length doesnt work
at this script , page length work
"bprocessing" : true,
"bserverSide" : true,
the data is 106,000 ++ rows
when serverSide:true, the server completely controls the number of rows sent back, not the client. DataTabes send back. The client sends, as part of the request, the number of the row of and the size of the page is sent so on page 1, among other things, {start:0, length:15} is sent so you can calculate and send back rows 0-15.
You send back recordsTotal with the data so data tables knows how many pages to show at the bottom.
But again, it up to server side code to figure out how many rows to send back based on the parameters passed to the server
then what must i do???
Exactly what @bindrid says. When using server-side processing, it is up to the server-side script that you are using to select just the rows that DataTables requests from the database, and then send them back to the client.
You need to use a LIMIT and OFFSET (or whatever the Mongo equivalent is) to limit the information being returned from the Mongo query to just what is required.
Whatever script you are using to access the Mongo database needs to be updated to provide that ability. See the manual for information on the parameters that DataTables sends to the server.
Allan
How i using the manual script ? can you give some example??
my recordsFiltered is show only 1 not 106K rows like recordsTotal, how to fix it??
not really as I don't use Mongo myself. You would need to refer to their documentation if you don't know how to limit the results using their API. This is the second top hit from google for mongo limit offset.
Allan
Thankyou Allan , i've done limiting my data right now , now i want to orderby and sorting data.
how to sort datatables mongodb serverside and searching ??
The MongoDB documentation is here. As I mentioned, I'm afraid I don't know Mongo myself as I really haven't used it. If you need help with the basis of how to use Mongo I would suggest reading their documentation or asking on StackOverflow.
Allan