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

MongoDB generated ID #38

Open
pelagaggi opened this issue Mar 24, 2019 · 1 comment
Open

MongoDB generated ID #38

pelagaggi opened this issue Mar 24, 2019 · 1 comment

Comments

@pelagaggi
Copy link

Hello, I am using node-red-contrib-monggodb3 and having troubles to pass an ObjectId as an argument, not being able to use a MongoDB auto-generated _id, is there any way to use "_id": 'ObjectId("myID")' as an argument?
I.E
I have the following document in my collection:

{
    "_id" : ObjectId("5c9156c7f8c3ec3259454571"),
    "name" : "teste_site_1",
}

If I pass as msg.payload to findOne Operation

msg.payload = {"name":"teste_site_1"}

returns my document without ObjectID in _id

{
    "_id" : "5c9156c7f8c3ec3259454571",
    "name" : "teste_site_1",
}

if I pass the _id as agument:

msg.payload = {"name":"teste_site_1"}

returns empty.
I can not call ObjectId in node-red and also cannot pass as string ObjectId.

Is this a bug or am I missing something?

@pelagaggi
Copy link
Author

I have found a workaround and left in stackoverflow.

Not sure if this is the correct way of dealing with the issue.

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

1 participant