Click here to Skip to main content
14,392,678 members
   

Database

 
AnswerRe: database ER diagrime Pin
Victor Nijegorodov26-Oct-19 6:21
MemberVictor Nijegorodov26-Oct-19 6:21 
AnswerRe: database ER diagrime Pin
Mycroft Holmes26-Oct-19 14:05
MemberMycroft Holmes26-Oct-19 14:05 
GeneralRe: database ER diagrime Pin
Richard MacCutchan26-Oct-19 22:46
mveRichard MacCutchan26-Oct-19 22:46 
QuestionFetch data Pin
Member 1463481125-Oct-19 3:34
MemberMember 1463481125-Oct-19 3:34 
AnswerRe: Fetch data Pin
Richard Deeming25-Oct-19 3:58
communityengineerRichard Deeming25-Oct-19 3:58 
QuestionRe: Fetch data Pin
ZurdoDev25-Oct-19 5:22
professionalZurdoDev25-Oct-19 5:22 
Questionc# MongoDB Driver, find all products that contain a single brand name, and Group Distinct all category names, then get those categories. Pin
jkirkerx22-Oct-19 11:25
professionaljkirkerx22-Oct-19 11:25 
AnswerRe: c# MongoDB Driver, find all products that contain a single brand name, and Group Distinct all category names, then get those categories. Pin
jkirkerx22-Oct-19 11:41
professionaljkirkerx22-Oct-19 11:41 
I came up with this and it works so far. A combination of Mongo and Linq.
Changed some categoryDistinct to productDistinct, better name.
I actually didn't think it would work.
var brandTask = _context.Brands.Find(b => b.Name == brandName).FirstOrDefaultAsync();

var productsFiltered = _context.Products.Find(b => b.Brand == brandName).ToList();
var productsDistinct = productsFiltered.GroupBy(c => c.Category).Select(x => x.FirstOrDefault());
var categoriesSelected = new List<Category>();
foreach (var product in productsDistinct)
{
    var cx = _context.Categories.Find(c => c.Name == product.Category).First();
    if (cx != null)
    {
        categoriesSelected.Add(cx);
    }
}

// Use filters here for a more complex search of products
var productFilter = Builders<Product>.Filter.Eq("Brand", brandName);
var productsTask = _context.Products.Find(productFilter).ToListAsync();

await Task.WhenAll(brandTask, productsTask);

return new GetBrandPage { Brand = brandTask.Result, Categories = categoriesSelected, Products = productsTask.Result };
If it ain't broke don't fix it
Discover my world at jkirkerx.com

QuestionHow do you separate in pages database results? Pin
Joan M21-Oct-19 11:00
professionalJoan M21-Oct-19 11:00 
AnswerRe: How do you separate in pages database results? Pin
David Mujica23-Oct-19 3:48
MemberDavid Mujica23-Oct-19 3:48 
QuestionI have a column and i need to find in which table this column exists throughout whole DB Pin
Anandkumar Prajapati8-Oct-19 20:29
professionalAnandkumar Prajapati8-Oct-19 20:29 
AnswerRe: I have a column and i need to find in which table this column exists throughout whole DB Pin
Victor Nijegorodov8-Oct-19 21:46
MemberVictor Nijegorodov8-Oct-19 21:46 
AnswerRe: I have a column and i need to find in which table this column exists throughout whole DB Pin
Jörgen Andersson8-Oct-19 22:11
professionalJörgen Andersson8-Oct-19 22:11 
Questionvb.net connection to a firebird database Pin
Member 767827622-Sep-19 18:15
MemberMember 767827622-Sep-19 18:15 
AnswerRe: vb.net connection to a firebird database Pin
Victor Nijegorodov22-Sep-19 21:12
MemberVictor Nijegorodov22-Sep-19 21:12 
GeneralRe: vb.net connection to a firebird database Pin
Member 767827623-Sep-19 12:06
MemberMember 767827623-Sep-19 12:06 
GeneralRe: vb.net connection to a firebird database Pin
Member 767827623-Sep-19 17:16
MemberMember 767827623-Sep-19 17:16 
GeneralMessage Closed Pin
1-Oct-19 16:26
Memberhayac h1-Oct-19 16:26 
QuestionMoving from access DB to Oracle to calculate average upon request Pin
Member 1447460719-Sep-19 12:12
MemberMember 1447460719-Sep-19 12:12 
AnswerRe: Moving from access DB to Oracle to calculate average upon request Pin
Gerry Schmitz19-Sep-19 13:26
mveGerry Schmitz19-Sep-19 13:26 
QuestionMySQL database Pin
Alboyz17-Sep-19 17:46
MemberAlboyz17-Sep-19 17:46 
AnswerRe: MySQL database Pin
#realJSOP18-Sep-19 2:08
mve#realJSOP18-Sep-19 2:08 
GeneralRe: MySQL database Pin
Alboyz18-Sep-19 17:58
MemberAlboyz18-Sep-19 17:58 
AnswerRe: MySQL database Pin
Mycroft Holmes18-Sep-19 13:44
MemberMycroft Holmes18-Sep-19 13:44 
GeneralRe: MySQL database Pin
Alboyz18-Sep-19 17:58
MemberAlboyz18-Sep-19 17:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.