loopbackio / loopbackio/loopback-next

Better docs for Repository.execute

Open
#5,264 3 comments 0 reactions 1 assignee Claimed by @hacksparrow View on GitHub
Docs good first issue Repository
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

I noticed that we don't have a good documentation on how to use `Repository.execute` method. The API docs is very vague:

```ts
/**
* Execute a query with the given parameter object or an array of parameters
* @param command - The query string or command object
* @param parameters - The object with name/value pairs or an array of parameter
* values
* @param options - Options
*/
```

Let's improve the docs to show examples how to use `execute` for SQL databases using parameterized queries (to avoid SQL injection attacks).

~~If https://github.com/strongloop/loopback-next/issues/3342 is not implemented yet, then add a mention about NoSQL flavors not being supported yet, link to that GitHub issue and update it's acceptance criteria to request a MongoDB example to be added to the API docs. If the issue is already implemented, then~~

Add a MongoDB example as part of this story.

Prior work:
- https://loopback.io/doc/en/lb3/Executing-native-SQL.html

## Acceptance criteria

- [x] Add proper API docs for `Repository.execute`, details see ^.
- [x] Update the https://github.com/strongloop/loopback-next/issues/3342 acceptance criteria to include an example for MongoDB.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.