Click here to Skip to main content
14,364,290 members
   

Database

 
PinnedHOW TO ANSWER A QUESTION Pin
Chris Maunder16-Jul-09 4:10
adminChris Maunder16-Jul-09 4:10 
PinnedHow to get an answer to your question PinPopular
Chris Maunder10-Nov-05 17:30
adminChris Maunder10-Nov-05 17:30 
QuestionSQL Server How to add and update element in xml data in table based on match found after search using xquery Pin
Mou_kol16-Nov-19 9:20
memberMou_kol16-Nov-19 9:20 
QuestionPivoting in SQL Pin
Anandkumar Prajapati13-Nov-19 0:50
professionalAnandkumar Prajapati13-Nov-19 0:50 
AnswerRe: Pivoting in SQL Pin
Richard Deeming13-Nov-19 3:17
mveRichard Deeming13-Nov-19 3:17 
GeneralRe: Pivoting in SQL Pin
#realJSOP15-Nov-19 1:18
mve#realJSOP15-Nov-19 1:18 
QuestionHow to think in MongoDB/Mongoose ?! Pin
AlexanderKolarov7-Nov-19 12:33
memberAlexanderKolarov7-Nov-19 12:33 
QuestionMessage Closed Pin
26-Oct-19 11:08
memberMember 1463562026-Oct-19 11:08 
QuestionMessage Closed Pin
26-Oct-19 11:08
memberMember 1463562026-Oct-19 11:08 
Questiondatabase ER diagrime Pin
Member 1463562026-Oct-19 5:01
memberMember 1463562026-Oct-19 5:01 
AnswerRe: database ER diagrime Pin
OriginalGriff26-Oct-19 5:02
protectorOriginalGriff26-Oct-19 5:02 
QuestionRe: database ER diagrime Pin
Member 1463562026-Oct-19 5:14
memberMember 1463562026-Oct-19 5:14 
AnswerRe: database ER diagrime Pin
Richard MacCutchan26-Oct-19 5:18
protectorRichard MacCutchan26-Oct-19 5:18 
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
protectorRichard 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
mveRichard 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 

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.