odata-v4-server icon indicating copy to clipboard operation
odata-v4-server copied to clipboard

?$expand does not work properly

Open nigel-dewar opened this issue 7 years ago • 5 comments

Expand seems to be broken on both of these examples

https://github.com/jaystack/odata-v4-server-mongodb-example https://github.com/jaystack/odata-v4-server-mssql-example

If you visit http://services.odata.org/V4/ samples and use the following url

http://services.odata.org/V4/(S(ggb5l0d13uzsg0ro2qgrpoa4))/TripPinServiceRW/People?$expand=Trips

You will see you can get People and also their Trips

But if you try to do a similar query with odata-v4-server it breaks. For example

this breaks

http://localhost:3000/Products?$expand=Category

The console pumps out this error ( Im using the SQL server example in this case )

image

(node:10068) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of undefined
(node:10068) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I can see the navigation property for Category is indeed there image

Is this a bug, or am I not using this navigation property the way its intended? Is there some kind of Containment property that needs to be included on the NavigationProperty?

I did notice the navigation property in the services.odata.org sample is different, and includes a ContainsTarget property.

image

My details

Windows 10 Pro x64 Node version 8.1.1 npm version 5.0.3

The MS SQL Server sample has the following dependencies

"devDependencies": { "@types/express": "^4.0.34", "@types/mssql": "^3.1.30", "chai": "^3.5.0", "mocha": "^3.2.0", "mochawesome": "^1.5.4", "typescript": "^2.0.10" }, "dependencies": { "express": "^4.14.0", "msnodesqlv8": "^0.2.10", "mssql": "^3.3.0", "odata-v4-mssql": "^0.1.0", "odata-v4-server": "^0.1.15" }

nigel-dewar avatar Feb 24 '18 21:02 nigel-dewar

This is also true with the pgsql example.

aetherity avatar Mar 26 '18 14:03 aetherity

I have same problem.

RinatMullayanov avatar Mar 28 '18 11:03 RinatMullayanov

me too.

quocvc avatar May 21 '19 02:05 quocvc

I have same problem. HELP ME

sgiraldo62 avatar Aug 16 '19 20:08 sgiraldo62

Does anyone find a way to solve this issue? please help

hanyoujia avatar Jan 28 '20 02:01 hanyoujia