mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(MongoDB Node): Add projection to query options on Find (#9972)
Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
@@ -196,6 +196,8 @@ export class MongoDb implements INodeType {
|
||||
const options = this.getNodeParameter('options', i);
|
||||
const limit = options.limit as number;
|
||||
const skip = options.skip as number;
|
||||
const projection =
|
||||
options.projection && (JSON.parse(options.projection as string) as Document);
|
||||
const sort = options.sort && (JSON.parse(options.sort as string) as Sort);
|
||||
|
||||
if (skip > 0) {
|
||||
@@ -208,6 +210,10 @@ export class MongoDb implements INodeType {
|
||||
query = query.sort(sort);
|
||||
}
|
||||
|
||||
if (projection && projection instanceof Document) {
|
||||
query = query.project(projection);
|
||||
}
|
||||
|
||||
const queryResult = await query.toArray();
|
||||
|
||||
for (const entry of queryResult) {
|
||||
|
||||
Reference in New Issue
Block a user