Mongodb3 count problem

I am using node-red-contrib-mongodb3 driver.
I got "find", "aggregate" requests work, but I can not make count requests work.

In the function preceeding mongodb3 call, I write :
return msg;

As a response, I get :
payload: object

instead of the number of elements.

I would appreciate to have any help or hint !


Read your code.


result: msg.payload is empty.

Thanks for your response.

the msg.payload is supposed to contain the request on the collection.
If I put : msg.payload=[{"test":"12"}]; to filter the documents in the collection, I still get
the same response :
payload: object

  • From the doc:

Count returns a count of the number of documents in a collection or matching a query using the msg.payload as the query statement.

Yes, That's why I Don't understand the behavior.
I think the problem has to do with the mongodb3 node.

I just tried withe mongoDB2, and the results are ok.
Furthermore, I was surprised that find.toArray and aggregate.toArray return an object in mongodb3, vs an array, in MongoDB and mongodb2.

Maybe It is worth using Mongodb2 driver ...

Count is working here...
mongodb3 version 1.0.0

interesting, … I have 2.0.0 (and mongo db version is 3.6.12)

Maybe you've found a bug...
Server here is 3.6.4, but i would start looking at the node.

I juste tested with mondodb3 driver.
1.0.0 works,
2.0.0 (and 2.0.1) don't work… (I upgraded from 1.0.0 to 2.0.0)

Thanks for your help