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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:00:45+00:00 2026-06-13T08:00:45+00:00

Iam using mongo as an db for my web app. Java code queries the

  • 0

Iam using mongo as an db for my web app. Java code queries the data from mongo. Curntly there is >40000 in mongo . In one of my api it will return all that documents. So i need only 50 documents to show on the web page. I have tried cursor.limit(50) but it only reduces the time taken by while loop. so i think the whole time is taking from this code DBCursor cursor=collection.find(query,field) . Any ways to reduce it..?.

  • 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-13T08:00:46+00:00Added an answer on June 13, 2026 at 8:00 am

    Take a look at Database Profiler section of the mongodb documentation. It describes ways of finding out how much time the query execution is taking and then in a later section talks about how to optimize the query.

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

Sidebar

Related Questions

I am using PHP/Mongo to query a data set like the following: { description:
I am using the Mongo Ruby driver and have this block of Ruby code
I have a mongoose and connect-mongo module instance in ym app. I am using
I am developing a web app using Codeigniter and MongoDB. I am trying to
I developed a simple .net application that scrapes some data from web and saves
I am developing a web app using Codeigniter and MongoDB. I need to create
I am using cherrypy and mongo for a small web application. At some point
I am trying to learn web development using Mono. Coming from ASP.NET background, I
I am using Mongo in its simplest avatar possible (in conjunction with Spring Data).
I am using mongo-db for realtime analytics, I am getting 5 million data points

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.