Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "ProductId": 1,
- "Status": true,
- "Code": "123456",
- "IsRecall": false,
- "ScanLog": [
- {
- "Location": {
- "type": "Point",
- "coordinates": [
- 13.5957758,
- 42.7111538
- ]
- },
- "TimeStamp": 201602160957190600,
- "ScanType": 0,
- "UserId": "1004"
- },
- {
- "Location": {
- "type": "Point",
- "coordinates": [
- 13.5957907,
- 42.7111359
- ]
- },
- "TimeStamp": 201602161246336640,
- "ScanType": 0,
- "UserId": "1004"
- }
- ]
- }
- SELECT c.Code, b.TimeStamp FROM c JOIN b IN c.ScanLog ORDER BY b.TimeStamp
- Order-by over correlated collections is not supported.
- function sortScanLog (scanLog) {
- function compareTimeStamps(a, b) {
- return a.TimeStamp - b.TimeStamp;
- }
- return scanLog.sort(compareTimeStamps);
- }
- SELECT c.ProductId, udf.sortScanLog(c.ScanLog) as ScanLog FROM c
- function compareTimeStamps(b, a)
Add Comment
Please, Sign In to add comment