axkrishnan
Posts: 0
Joined: Tue Jul 29, 2014 12:14 am

Database projection with computed fields fails silently

I am trying to use MongoDB's projection feature to rename a field that I am returning from a query as described near the end of http://docs.mongodb.org/manual/refere...

In the example that is provided in that document, the field "copies" is renamed to "copiesSold" in the result.

I have created a test table with the default columns and a string column named "name". It can be seen in the attached screenshot. Image

When I use projection without the renaming feature, everything works as expected:

precurl -X GET -H "X-Appery-Database-Id: 54011bace4b055c018db1489" -G --data-urlencode 'proj={"name":1}' https://api.appery.io/rest/1/db/collections/projectme

Response: [{"_id":"54011bd9e4b055c018db148d","name":"hello"}]/pre

However, if I try to rename the column the projection fails silently and omits the requested column, but still returns the "_id" column.

precurl -X GET -H "X-Appery-Database-Id: 54011bace4b055c018db1489" -G --data-urlencode 'proj={"new_name":"$name"}' https://api.appery.io/rest/1/db/collections/projectme

Response: [{"_id":"54011bd9e4b055c018db148d"}]/pre

Eventually I would like to do more than just rename columns, but actually use the dot notation to access members of an embedded document, but for the test case I am simply using the feature to rename a field.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Database projection with computed fields fails silently

Hi -

Thanks for pointing on this issue, we'll investigate this case and we'll let you know when have more information from developers team.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Database projection with computed fields fails silently

Hi axkrishnan,

Currently Appery.io support only restriction in return object:
You can read more here:

http://devcenter.appery.io/documentat...

Also you can read about it on mongo DB: http://docs.mongodb.org/manual/tutori...

I see you use mongo db "$project (aggregation)" that's not currently supports by Appery.io.

http://docs.mongodb.org/manual/refere...

Regards.

axkrishnan
Posts: 0
Joined: Tue Jul 29, 2014 12:14 am

Database projection with computed fields fails silently

Ok thanks. That's too bad, it would be a handy feature. I wish the documentation was more clear on exactly which mongo features are and aren't supported, because I've definitely used a few mongo features that aren't mentioned in the docs but still works, so I incorrectly assumed that this would too.

You can go ahead and mark this question as resolved for now.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Database projection with computed fields fails silently

Hello Axkrishnan,

Thank you for the update.

Return to “Issues”