I have a very strange issue:
My `.find()` method and `.count()` method do not return objects that are compatible, eg `.find()` returns no object at all, and `.count()` returns 1.
Here is my code (Coffeescript)
config = require('../config.js')
MongoClient = require('mongodb').MongoClient
MongoClient.connect("mongodb://
127.0.0.1:27017/#{config.General.database}",(err,db)->
callback=(err,hands)->
if err then throw err
console.log 'find:'+hands.length
callbackOne=(err,hands)->
if err then throw err
console.log 'findOne:'+hands
db.collection('hands').find({"processed":null}).toArray(callback)
db.collection('hands').findOne({"processed":null},callbackOne)
db.collection('hands').count({"processed":null},(err,c)->
console.log 'count:'+c
)
)
Here's a gist to the compiled JS:
https://gist.github.com/27a7790580a88628aa51This returns:
find:0
findOne:null
count:1
My database consists of a huge amount of 'hands' (around 1.7 million), which are indexed with the `processed` flag.
When I run `db.hands.find()` and `db.hands.count()` in mongo command line, I get the expected result (eg the hand object, and 1).
If I roll back to version 1.4 of the nodejs mongo driver, find and count seem to work consistently.
I have also found out that if I insert another hand element, the `find` is working again.
I'm running mongod without any special options, and I am on a development machine.
Any ideas why this strange behavior ?
# Edit:
Restarting mongod didn't change anything.