Ok so perhaps I’m overlooking something really simple, or perhaps it’s unsupported at this time. I’ve done the work elsewhere to find an _id of interest, and now I would like to fetch the document and start operating on the data.
I have tried what I believe to be every permutation of quoting & nomenclature on the ‘find’ query for MongoDB but am unable to return the record of interest. I’ve reviewed the actual node definition and see the passthrough nature of the query section, but I can’t call the ‘ObjectID’ function of the module which mongo seems to require.
Example Expression:
{"_id":“ObjectId(‘5a17224770a39f0024481dab’)”}
So my question: Is it at all possible within N8N to directly look-up a mongodb record using it’s key?
Thanks in Advance.
Did just get added. With the next version it converts the string that is set as _id to an ObjectID. Will update here once it got released (probably tomorrow).
What about fields that are not “_id”? For example foreign keys will have a different key name, but require querying using ObjectIds. Not sure if it’s feasible, but it would probably make a lot more sense to work with MongoDB using the mongo shell. It’s very difficult to express some queries in pure JSON form, so all MongoDB query IDEs usually allow you to interact with a shell instead.
Personally, instead of a bunch of allowed operations (like Find, or Aggregate), I’d rather just have the flexibility to run a mongo shell script.
A couple of other things this would allow you to do, but that can’t be done today.