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

  • SEARCH
  • Home
  • 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 9140613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:32:21+00:00 2026-06-17T09:32:21+00:00

I have a mongodb query, and I want to add a computed field. The

  • 0

I have a mongodb query, and I want to add a computed field. The computed field is based on where or not the item is in the results of another query. So my query returns the columns a,b,c,d, and then column e should be based on whether or not the current row would be matched by another query.

Is there an efficient way to do this in mongo? I’m not really sure how to do this one…

  • 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-17T09:32:22+00:00Added an answer on June 17, 2026 at 9:32 am

    There is no way currently to execute a function as you describe within the database when returning a document via standard functions such as find. It’s been requested by the community, but the general request is to operate only on a single document.

    There are calculated fields using $project in the aggregation framework. But, they only operate on the current document in the pipeline. So, they can’t summarize other queries.

    You’ll need to likely build your e value as part of your data access layer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem here. I want to query my MongoDB in my Node
I have Document in MongoDB like this: {ONE: {TWO: {THREE:5}}} I want to query
In MongoDB I have a query which looks like this to find out for
I have this query in MongoDB db.privateMessages.find( { $or : [ {fromId: userId, toId:
I am using the MongoDB PHP Library and have the following query array Array
I have a MongoDB collection with data that was not saved through my Derby
I have inserted document s into MongoDB without an id . And I want
I am using the $in clause within a mongodb query. However, I want my
I have a MongoDB collection Marks with fields student_id,Subject,Mark. I want to the average
I have a chatroom system, and I want to use MongoDB as the backend

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.