Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

[proposal] Update javascript code block examples for query language doc #1313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
28 changes: 14 additions & 14 deletions concepts/ORM/Querylanguage.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ The following modifiers are available to use when building queries.

Searches for records where the value is less than the value specified.

```usage
```javascript
Model.find({
age: { '<': 30 }
});
Expand All @@ -137,7 +137,7 @@ Model.find({

Searches for records where the value is less or equal to the value specified.

```usage
```javascript
Model.find({
age: { '<=': 20 }
});
Expand All @@ -147,7 +147,7 @@ Model.find({

Searches for records where the value is greater than the value specified.

```usage
```javascript
Model.find({
age: { '>': 18 }
});
Expand All @@ -157,7 +157,7 @@ Model.find({

Searches for records where the value is greater than or equal to the value specified.

```usage
```javascript
Model.find({
age: { '>=': 21 }
});
Expand All @@ -167,7 +167,7 @@ Model.find({

Searches for records where the value is not equal to the value specified.

```usage
```javascript
Model.find({
name: { '!=': 'foo' }
});
Expand All @@ -177,7 +177,7 @@ Model.find({

Searches for records where the value is in the list of values.

```usage
```javascript
Model.find({
name: { in: ['foo', 'bar'] }
});
Expand All @@ -187,7 +187,7 @@ Model.find({

Searches for records where the value is NOT in the list of values.

```usage
```javascript
Model.find({
name: { nin: ['foo', 'bar'] }
});
Expand All @@ -197,7 +197,7 @@ Model.find({

Searches for records where the value for this attribute _contains_ the given string.

```usage
```javascript
var musicCourses = await Course.find({
subject: { contains: 'music' }
});
Expand All @@ -209,7 +209,7 @@ _For performance reasons, case-sensitivity of `contains` depends on the database

Searches for records where the value for this attribute _starts with_ the given string.

```usage
```javascript
var coursesAboutAmerica = await Course.find({
subject: { startsWith: 'american' }
});
Expand All @@ -221,7 +221,7 @@ _For performance reasons, case-sensitivity of `startsWith` depends on the databa

Searches for records where the value for this attribute _ends with_ the given string.

```usage
```javascript
var historyCourses = await Course.find({
subject: { endsWith: 'history' }
});
Expand All @@ -243,7 +243,7 @@ in conjunction with a `where` key. The current options available are:

Limits the number of results returned from a query.

```usage
```javascript
Model.find({ where: { name: 'foo' }, limit: 20 });
```

Expand All @@ -253,15 +253,15 @@ Model.find({ where: { name: 'foo' }, limit: 20 });

Returns all the results excluding the number of items to skip.

```usage
```javascript
Model.find({ where: { name: 'foo' }, skip: 10 });
```

##### Pagination

`skip` and `limit` can be used together to build up a pagination system.

```usage
```javascript
Model.find({ where: { name: 'foo' }, limit: 10, skip: 10 });
```

Expand All @@ -279,7 +279,7 @@ Model.find({ where: { name: 'foo' }, limit: 10, skip: 10 });
Results can be sorted by attribute name. Simply specify an attribute name for natural (ascending)
sort, or specify an `ASC` or `DESC` flag for ascending or descending orders respectively.

```usage
```javascript
// Sort by name in ascending order
Model.find({ where: { name: 'foo' }, sort: 'name' });

Expand Down