Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I want to request a feature about alias #2156

Unanswered
JenuelDev asked this question in Q&A
Discussion options

So for example in SQL we have the select user_id as id from users
using as so that it will return data with a property name id instead of user_id.
sample output:

$users = [
 {
 id: 1
 },
 {
 id: 2
 },
 {
 id: 3
 },
 {
 id: 4
 },
 {
 id: 5
 },
]

How can this be done in lumen MongoDB? thanks 👍🏻

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Hello,

Please stop spamming new issues, you're asking questions and that's the reason why they should go to discussions.

Thanks!

You must be logged in to vote
1 reply
Comment options

oh no sorry, I'm not trying to spam, I'm just trying to at least request a new feature because I am using this library and In the docs.
Im just trying to request a feature for alias.

like for example, I like to have a query something like this. So that it will be easy to automatically alias a column.
using AS.

$users =
 User::where('user_id', '123')
 })->get(['firstName AS name']);
return json_encode($users)

So instead of returning this

[
 {
 firstName: 'Mark'
 },
 {
 firstName: 'John'
 },
]

It will return something like this

[
 {
 name: 'Mark'
 },
 {
 name: 'John'
 },
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2156 on December 18, 2020 05:53.

AltStyle によって変換されたページ (->オリジナル) /