Hi,
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 :
msg.collection="mycollection";
msg.payload={};
msg.operation="count";
return msg;
As a response, I get :
payload: object
empty
instead of the number of elements.
I would appreciate to have any help or hint !
regards,
Nicolas
Read your code.
msg.payload={};
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
empty
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
The Problem still exists.
MongoDB 3.6.14
mongodb3 Node 2.0.1
Does anyone know a solution or workaround?
Thanks for your help.
Hi Nicolas,
I came along your problem description as I got stuck with the use of find and aggregate in mongodb2 and mongodb3 nodes. You wrote that you managed to get find an aggregate to work, which is exactly the problem that I have - both are not working - neither in mongodb2 nor in mongodb3.
In both case I use the dynamic configuration of the node as the drop down list has neither the find entry nor one for the aggregate command. So I set the msg.operation to "find" or "aggregate" vice versa.
In both cases I got the following error: "no operation defined"
regards Andre
Hi,
msg.operation="find.toArray";
or “aggregate.toArray” should work !
thanks, indeed this was the missing piece What I do not really understand why the mongodb2 node is offering a dynamic configuration, when I cannot use the basic find() or is it limited to the functions that are offered in the drop down box ?
BR Andre