was wondering if there is an array slice support in MongoLab’s REST API. I was trying out this:
https://api.mongolab.com/api/1/databases/<my-db>/collections/<my-coll>?apiKey=<my-api-key>&q={_id:1234},{arrayName:{$slice:2}}
My schema is in the following format
{
"_id": "1234",
"arrayName": [
{ "f_id": "661963387",
"f_name": "Test",
},
{ "f_id": "661963387",
"f_name": "Test",
},
{ "f_id": "661963387",
"f_name": "Test",
}
]
}
The query works on the terminal. Is there a way I can get it working using the REST API ?
It should work if you put it in the fields parameter “f”.
q={‘_id’:1234}&f={‘arrayName’:{‘$slice’:2}}
-will