Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project documents to a flat table for reporting #396

Open
jeremydmiller opened this Issue May 26, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@jeremydmiller
Copy link
Contributor

jeremydmiller commented May 26, 2016

We've talked about this since we first started Marten, but never recorded the user story for it. Came up today in a discussion at work.

I think it might be how we pull off "map/reduce" w/ groupings in Marten.

@jeremydmiller jeremydmiller modified the milestone: 1.1 Jun 20, 2016

@mdissel

This comment has been minimized.

Copy link
Contributor

mdissel commented Aug 12, 2016

Can we make Marten so smart that it will create the necessary JS code to transform the fields on the server?

@jeremydmiller

This comment has been minimized.

Copy link
Contributor Author

jeremydmiller commented Aug 12, 2016

I don't think you'd need any JS code. It's really not that much different mechanically from the existing duplicated field functionality.

@mdissel

This comment has been minimized.

Copy link
Contributor

mdissel commented Aug 12, 2016

Is this the functionality you have in your mind? (i have ;) )

Order.CompanyID is foreign key to Company. Mapping is based on propercase "ClassPropertyName"

public class Company
{
    public int ID { get; set; }
    public string Name { get; set; }
}

public class Order
{
    public int ID { get; set; }
    public int CompanyID { get; set; }
    public DateTime DateOrdered {get;set;}
}

Public class CompanyOrderDTO {
    public int CompanyID { get; set; }
    public string CompanyName { get; set; }
    public DateTime OrderDateOrdered {get;set;}
}

query.Query<CompanyOrderDTO, Company>()
                    .Include<Order>(x => x.CompanyID)
                    .Where(x => x.ID > 0)
@jeremydmiller

This comment has been minimized.

Copy link
Contributor Author

jeremydmiller commented Aug 12, 2016

@mdissel No, that's a different thing altogether. This is about projecting documents or event streams to a flat table for reporting purposes.

@mdissel

This comment has been minimized.

Copy link
Contributor

mdissel commented Aug 12, 2016

Ok, but the CompanyOrderDTO is also a 'flat table'.

Is something like i mean planned? the SELECT statement that marten should generate is something like

SELECT c.data ->> 'name' as CompanyName, o.data ->> 'DateOrdered' as OrderDateOrdered from mt_doc_company c inner join mt_doc_order o on c.id = o.companyid

@jeremydmiller jeremydmiller added this to the 3.0 milestone Aug 31, 2018

@jeremydmiller jeremydmiller removed this from the 3.0 milestone Sep 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.