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 7727041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:21:36+00:00 2026-06-01T05:21:36+00:00

I have mongodb running and using morphia. Having a Collection of BatchData Documents and

  • 0

I have mongodb running and using morphia.
Having a Collection of BatchData Documents and need to filter out some field values.

This is the Entity:

@Entity
public class BatchData {

  @Id private ObjectId id;
  public int val1;
  public int val2;
  public String uuid;

}

If val1 equals val2 then the query should return uuid

This is as far as a get but ofcourse it does not work:

Query<BatchData> q = mongo.createQuery(BatchData.class).field("val1").equal("val2");
List<BatchData> entities = q.asList();

OR

Query<BatchData> q = mongo.createQuery(BatchData.class).field("val1").equal(BatchData.class.val2)

There can be one million or more BatchData Documents so i must only
return the uuid for performance reason.

Been reading the wiki and cannot understand or see a filter for two member fields
Morphia wiki

  • 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-01T05:21:38+00:00Added an answer on June 1, 2026 at 5:21 am

    If the performance is very important, you should look at map-reduce function. Unfortunately, morphia does not support this MongoDB feature, so you need to work with java mongo driver itself. See example and docs.

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

Sidebar

Related Questions

I have simple MongoDB collection and I am using SLIM micro-framework to develop a
I have a large collection (~2.7 million documents) in mongodb, and there are a
I'm running node.js on OSX and have just installed mongodb using command npm install
I have dates stored in MongoDB using Date(), MongoDB uses UTC it's date type,
I have a collection of articles in MongoDB that has the following structure: {
I have some properties in two bash scripts I want substituted when running mvn
I have a Rails 3.1 app, running on Ruby 1.9.2, Mongo 2.0.2, using Mongoid
So mongoDB is running on 27017 and my collection name is test. try {
I'm running MongoDB on Windows. I have 1 or more threads that drop and
I'm trying to do some benchmarking of Twisted & Tornado with Mongodb. I have

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.