christkv/node-mongodb-native — Issue #462: hangs on query
Author: axkibe
Created: 2011-12-28 12:37:36+00:00
State: open

I have been using mongodb for a while now and am quite happy. But up until recently with a new installation the mojo is just gone. I get random hangups everywhere. Below is a simple script trying to go through a collection. It will hang. I tried also code with paging, anything larger than 10 hangs, requesting 10 in a time hangs 1 in 100 (counts to ~1000 then hangs). Using toArray hangs, using nextObject hangs. Any ideas? Same query works fine in the mongo shell. Only thing I get an idea left to try is to try older versions of node-mongodb-native.

---
"use strict";

var util = require('util');
var mongo = require('mongodb');

var dbhost = '127.0.0.1';
var dbport = mongo.Connection.DEFAULT_PORT;

var dbserver = new mongo.Server(dbhost, dbport, {});
var dbconnector = new mongo.Db('twaaaj', dbserver, {});

util.log('Connecting to database');
dbconnector.open(function(err, dbclient) {
dbclient.collection('twdata', function(err, twdata) {
twdata.find({}, {}, {limit: 100}, function(err, cursor) {
cursor.count(function(err, count) {
util.log('Processing '+count+' tweets.');
var oi = 0;
cursor.each(function(err, obj) {
util.log(oi++);
});
});
});
});
});