MongoDB timeout issue (Node.js)
<p>I have an application in Node.JS which basically retrieves a snapshot of data from a WebAPI each 30 minutes.
When I try to interrogate the database by using an aggregate query, the app triggers an error related to timeout (MongoError: connection 1 to 127.0.0.1:27017 timed out). From my logs I see that it's exactly 30 seconds.
The aggregate query is something like this:</p>

<pre><code>collection.aggregate([{
            "$group": {
                "_id": {
                    country: "$country",
                    user: "$user"
                }
            }
        }]).
</code></pre>

<p>I tested the query on a different client (but the same database) and it takes aprox 60 seconds for 25.000.000 records. My assumption is that there is a timeout parameter with the value of 30 seconds that blocks my application from finish the query.
Can someone tell me how can I set this parameter up in Node.JS? I'm using 'mongodb' js library and my host machine is Windows.</p>

<p>Since this is a personal project I wanted to investigate how can I use MongoDB instead of a more traditional solution, such as Oracle or MySQL, but this might be a deal breaker since analytics is a core part of the entire application.</p>