Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/make/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const arraySequenceIndexOf = require('../arraySequenceIndexOf');
const lodash = require('lodash');
/**
* Parses a sql statement into a mongo aggregate pipeline
*
* @param {import('../types').ParserInput} sqlOrAST - The sql to make into an aggregate
* @param {import('../types').ParserOptions} [options] - the parser options
* @param {import('../types').NoqlContext} [context] - The Noql context to use when generating the output
Expand Down Expand Up @@ -57,7 +56,6 @@ function makeMongoAggregate(sqlOrAST, options = {unwindJoins: false}, context) {
}
/**
* Converts a SQL statement to a mongo query.
*
* @param {import('../types').ParserInput} sqlOrAST - the SQL statement or AST to parse
* @param {import('../types').ParserOptions} [options] - the parser options
* @param {import('../types').NoqlContext} [context] - The Noql context to use when generating the output
Expand All @@ -78,7 +76,7 @@ function makeMongoQuery(sqlOrAST, options = {}, context) {
const result = createResultObject();
/** @type{import('../types').ParsedMongoQuery} */
const parsedQuery = {
limit: 100,
limit: options.noDefaultLimit ? undefined : 100,
collection: ast.from[0].table,
type: 'query',
};
Expand Down
2 changes: 2 additions & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ export interface ParserOptions {
schemas?: Schemas;
/** If true, will optimize the join for better performance */
optimizeJoins?: boolean;
/** No default limit, default is 100. If false or undefined, the default limit will be used */
noDefaultLimit?: boolean;
}

export interface NoqlContext extends ParserOptions {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@synatic/noql",
"version": "5.0.1",
"version": "5.0.2",
"description": "Convert SQL statements to mongo queries or aggregates",
"main": "index.js",
"files": [
Expand Down
Loading