Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:25:53+00:00 2026-06-17T11:25:53+00:00

I have a bunch of documents: { name : A, value : 10}, {

  • 0

I have a bunch of documents:

{ "name" : "A", "value" : 10},
{ "name" : "B", "value" : 12},
{ "name" : "B", "value" : 14},
{ "name" : "A", "value" : 16},
{ "name" : "C", "value" : 11}

I want to find the minimum value for each name, so the result would be

{ "name" : "A", "value" : 10},
{ "name" : "B", "value" : 12},
{ "name" : "C", "value" : 11}

What is the correct way to do this query in Mongo? I keep thinking in terms of SQL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:25:54+00:00Added an answer on June 17, 2026 at 11:25 am

    For the minimum, you can do this by using Mongo’s Aggregation Framework with “$group” and “$min”. Assuming that you had a collection named “myCollection,” you could try something like this:

    db.myCollection.aggregate({$group:{_id:"$name", minimumValue: {$min : "$value"}}});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of documents with tags in it like this (in bold):
I have a bunch of pdf documents in Google drive and I want them
I have lots of directories filled with a bunch of TeX documents. So, there's
I need to parse a bunch of incoming xml documents, they all have the
I have bunch of lists like this: out[3] [[3]] [1] forum=28&mid=11883 [2] forum=29&mid=11884 out[4]
week DKK id=radio2 value=75 /> I have bunch of these div entry generated by
We have a bunch of requirements documents and class diagrams, but are missing the
I have a bunch of PDF files that came from scanned documents. The files
I have custom code that reads a bunch of xml documents and creates a
I am having a find a replace in a bunch of RTF documents, The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.