mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Make it possible to query mongo document by _id
This commit is contained in:
@@ -71,9 +71,15 @@ export class MongoDb implements INodeType {
|
|||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const queryParameter = JSON.parse(this.getNodeParameter('query', 0) as string);
|
||||||
|
|
||||||
|
if (queryParameter._id && typeof queryParameter._id === 'string') {
|
||||||
|
queryParameter._id = new ObjectID(queryParameter._id);
|
||||||
|
}
|
||||||
|
|
||||||
let query = mdb
|
let query = mdb
|
||||||
.collection(this.getNodeParameter('collection', 0) as string)
|
.collection(this.getNodeParameter('collection', 0) as string)
|
||||||
.find(JSON.parse(this.getNodeParameter('query', 0) as string));
|
.find(queryParameter);
|
||||||
|
|
||||||
const options = this.getNodeParameter('options', 0) as IDataObject;
|
const options = this.getNodeParameter('options', 0) as IDataObject;
|
||||||
const limit = options.limit as number;
|
const limit = options.limit as number;
|
||||||
|
|||||||
Reference in New Issue
Block a user