ozomer / node-red-contrib-mongodb2

MongoDB driver node for Node-RED
Apache License 2.0
15 stars 19 forks source link

msg.limit and msg.sort do not work with mongodb2 #15

Closed vcailly closed 6 years ago

vcailly commented 6 years ago

msg.limit and msg.sort do not work with mongodb2

example with msg.limit=2 , mongoDB2 retrieves 5 documents

13/11/2017 à 14:38:43node: d8581fa.e306e6 msg : Object object payload: array[5] 0: object 1: object 2: object 3: object 4: object limit: 2 _msgid: "bea405f8.ccc488"

ozomer commented 6 years ago

Why should they work? The node only looks at the parameters passed in msg.payload

vcailly commented 6 years ago

it was working with mongdb node. So can you tell me how I can pass the limit value and the sort object in msg.payload. i did not find how to do it.

ozomer commented 6 years ago

You should set msg.payload to an array of parameters that will be passed to the chosen mongodb command. see: http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html