This seems like a purposeful decision. If this is not a bug, why can’t I get all items after an order call? The entire search result needs to be read from the Ontology anyways in order to sort it, why not give the option to return all records after the sort?
I can sort on the client side but I would much rather leverage the powerful servers backing the Ontology layer to do it for me.
Hi! For TS Functions V1, you should be able to perform .all().sort(…). I.e. retrieve all your objects first, then perform a sort on them based on a property.
For TS Function V2 (which uses osdk), you should be able to add $orderBy: {"<prop>": "asc"} to the args of your asyncIter
Your function will throw an error if more than 100,000 objects are loaded from the ObjectSet. Is there a reason why you couldn’t just set takeAsync(100000) in your existing function?
Yes, but if you consider the limitation when using allAsync, it is a much harder limit.
If you had >100k objects, you’d need a way to lower that amount, in order to not have the serverless function crash. This is what take() does in your case, meaning that the number of returned objects won’t crash your function.
You can even use this to implement some pagination in your application, should you need >100k objects in your workflow.