Question

NodeJS or MongoDB limits responses to 1000?

I have a NodeJS application that connects to MongoDB. I use AngularJS on my front-end. The NodeJS app contains all my GET, POST, DELETE API. I have a GET request that returns my “Colleges” collection in full as a JSON response. This collection has 7771 documents and I only return the ID and Name as a JSON response.

When I run my application locally on my development environment, it works great and my GET’s response is 7771 elements as JSON. When I uploaded my app and went live, I am seeing my GET’s response is exactly 1000. What gives?

Does DigitalOcean put a limit on API responses? Or is it a configuration in my NodeJS or Mongod? If someone can point me to a configuration that would be great.

Note: I installed both NodeJS and Mongod using sudo-apt-get instead of the 1-click installs. I have a Ubuntu 14.4 droplet. I am newbie to cloud app development and hosting (doing it as a learning experience), so please forgive me if I’m my deployment choices are not standard.

P.S: I am still hosting NodeJS on port 3000 with a redirect on port 80. My GET requests are via AJAX to “/colleges” that may be going to port 80, not sure that makes a difference.

Re-routing done by: sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It turned out to be a versioning issue with my production droplet. The droplet was running nodejs and mongodb that was coming from the ubtuntu repository hosted by digital ocean. The restriction was possibly coming from running older versions and I was not able to figure out how to apt-get newer versions from the Trusty Trah repository hosted by digitalocean.

Upon updating to NodeJS v4.0.0 and MongoDB v3.0.6 on my Ubuntu server, I was able to see my GET request now returning 7771 records as expected.

After a apt-get remove and purge of “mongodb” and “nodejs”, I ran the following to install NodeJS v4.1.2:

    curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
    sudo apt-get install -y nodejs

Next, I followed this guide to install mongodb 3.0.6 http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

This fixed all the limit issues I was having in the app.