Server Side Processing MongoDB limit

Server Side Processing MongoDB limit

rrtt22rrtt22 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

Answers

  • rrtt22rrtt22 Posts: 17Questions: 1Answers: 0

    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,

  • rrtt22rrtt22 Posts: 17Questions: 1Answers: 0

    the data is 106,000 ++ rows

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    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

  • rrtt22rrtt22 Posts: 17Questions: 1Answers: 0

    then what must i do???

  • allanallan Posts: 61,436Questions: 1Answers: 10,049 Site admin

    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

  • rrtt22rrtt22 Posts: 17Questions: 1Answers: 0

    How i using the manual script ? can you give some example??

  • rrtt22rrtt22 Posts: 17Questions: 1Answers: 0

    my recordsFiltered is show only 1 not 106K rows like recordsTotal, how to fix it??

  • allanallan Posts: 61,436Questions: 1Answers: 10,049 Site admin
    Answer ✓

    How i using the manual script ? can you give some example??

    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

  • rrtt22rrtt22 Posts: 17Questions: 1Answers: 0

    Thankyou Allan , i've done limiting my data right now , now i want to orderby and sorting data.

  • rrtt22rrtt22 Posts: 17Questions: 1Answers: 0

    how to sort datatables mongodb serverside and searching ??

  • allanallan Posts: 61,436Questions: 1Answers: 10,049 Site admin

    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

This discussion has been closed.