mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Remove linting exceptions in nodes-base, @typescript-eslint/no-unsafe-argument (no-changelog)
This commit is contained in:
@@ -21,7 +21,12 @@ import {
|
||||
validateAndResolveMongoCredentials,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import type { FindOneAndReplaceOptions, FindOneAndUpdateOptions, UpdateOptions } from 'mongodb';
|
||||
import type {
|
||||
FindOneAndReplaceOptions,
|
||||
FindOneAndUpdateOptions,
|
||||
UpdateOptions,
|
||||
Sort,
|
||||
} from 'mongodb';
|
||||
import { MongoClient, ObjectId } from 'mongodb';
|
||||
|
||||
import type { IMongoParametricCredentials } from './mongoDb.types';
|
||||
@@ -97,12 +102,12 @@ export class MongoDb implements INodeType {
|
||||
const queryParameter = JSON.parse(this.getNodeParameter('query', 0) as string);
|
||||
|
||||
if (queryParameter._id && typeof queryParameter._id === 'string') {
|
||||
queryParameter._id = new ObjectId(queryParameter._id);
|
||||
queryParameter._id = new ObjectId(queryParameter._id as string);
|
||||
}
|
||||
|
||||
const query = mdb
|
||||
.collection(this.getNodeParameter('collection', 0) as string)
|
||||
.aggregate(queryParameter);
|
||||
.aggregate(queryParameter as Document[]);
|
||||
|
||||
responseData = await query.toArray();
|
||||
} catch (error) {
|
||||
@@ -120,7 +125,7 @@ export class MongoDb implements INodeType {
|
||||
try {
|
||||
const { deletedCount } = await mdb
|
||||
.collection(this.getNodeParameter('collection', 0) as string)
|
||||
.deleteMany(JSON.parse(this.getNodeParameter('query', 0) as string));
|
||||
.deleteMany(JSON.parse(this.getNodeParameter('query', 0) as string) as Document);
|
||||
|
||||
responseData = [{ deletedCount }];
|
||||
} catch (error) {
|
||||
@@ -139,17 +144,17 @@ export class MongoDb implements INodeType {
|
||||
const queryParameter = JSON.parse(this.getNodeParameter('query', 0) as string);
|
||||
|
||||
if (queryParameter._id && typeof queryParameter._id === 'string') {
|
||||
queryParameter._id = new ObjectId(queryParameter._id);
|
||||
queryParameter._id = new ObjectId(queryParameter._id as string);
|
||||
}
|
||||
|
||||
let query = mdb
|
||||
.collection(this.getNodeParameter('collection', 0) as string)
|
||||
.find(queryParameter);
|
||||
.find(queryParameter as Document);
|
||||
|
||||
const options = this.getNodeParameter('options', 0);
|
||||
const limit = options.limit as number;
|
||||
const skip = options.skip as number;
|
||||
const sort = options.sort && JSON.parse(options.sort as string);
|
||||
const sort: Sort = options.sort && JSON.parse(options.sort as string);
|
||||
if (skip > 0) {
|
||||
query = query.skip(skip);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user