Search code examples
phpmongodbcurllimit

Request, with limit(results) in mongodb with curl at php


Perfectly i make the request and im getting the response. But i want to inject the "LIMIT" keyword at my query. At this moment my query is

'{"_id":"'.$id.'"}'

I also try this, and many random tries at this format

{"_id":"'.$id.'","limit":"6"}

With this i get all the rows. How and where can i inject the "Limit" MySQL's functionality keyword ? Note that i use GenieacsApi and i make a CURL request with unirest api. If you want more inforamtion. Please comment and i will provide them.


Solution

  • After reading the documentation of GeniacsApi I don't think you can limit results.

    Apparently, GeniacsApi only allows raw queries and the "limit" functionality is a stage of the aggregation framework, not of the querying part.

    If you cannot use the aggregation framework either the mongo client directly I don't think you can do it.