Skip to content

Execute raw NoSQL queries (e.g. MongoDB) #3342

@bajtos

Description

@bajtos

Suggestion

As I wrote in #2807 (comment), it is possible to execute raw SQL queries using the recently introduced Repository method execute, see #2681. This works great for SQL connectors.

Unfortunately, this method does not work for MongoDB and possibly for other NoSQL connectors that require more than just a command string and args array.

We need to find a way how to improve LB4 API, MongoDB connector API or both, to make it easy to execute raw MongoDB commands.

Related code:

Use Cases

Examples

const result = dataSource.execute('MyCollection', 'aggregate', [
    {
        $lookup:{
            .....   
        }
    },
    {   $unwind:"$data" },
    {
        $match:{
            ...
        }
    },
    {
        $lookup:{
            ... 
        }
    },
    {   $unwind:"$LoanRepayment" },
    { $project : { _id: 0} },
    { $out : "tempData" }
  ],
);

Acceptance criteria

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions