MongoDB generated ID
pelagaggi opened this issue · 1 comments
pelagaggi commented
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 commented
I have found a workaround and left in stackoverflow.
Not sure if this is the correct way of dealing with the issue.