Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find.toArray returning an object of objects instead of an array #37

Open
duartegarin opened this issue Mar 22, 2019 · 4 comments
Open

Comments

@duartegarin
Copy link

As the title says, find.toArray returning an object of objects instead of an array.
Is this by design?

@rcpehls
Copy link

rcpehls commented May 3, 2019

I have the same problem with node-red-contrib-mongodb3 but using node-red-contrib-mongodb2 return an array.

node-red-contrib-mongodb3
return {0: object,1: object,2: object}

node-red-contrib-mongodb2
return [object, object, object]

@nicolasC35
Copy link

Same pb. The problem was not present in 1.0.0 version.
In addition, the count operation returns an empty object (no value)

@ozomer
Copy link
Owner

ozomer commented May 13, 2019

I'm sorry but I don't have time to work on this. We are no longer using Node-RED in my company so I don't have motivation to make that effort 😅
If any of you wants to send a Pull-Request that fixes the issue and test it, I'll accept it blindly.

@haaslukas
Copy link

a workaround would be to add a function node after the mongodb node and convert the object to an array within nodered:
var obj = msg.payload
obj = Object.keys(obj).map((key) => obj[key]);
msg.payload = obj
return msg;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants