Skip to content

Commit

Permalink
Update dot concatenation of Express Tutorial Part 3 (mdn#20599)
Browse files Browse the repository at this point in the history
I think it improves reading as is more easy view what happens, if the dot is before the word.
From line 451 to 453 is used the convention that I'm trying to add here.
example change from "
  Athlete.
  find().
  where('sport').equals('Tennis')
"
to "
  Athlete
  .find()
  .where('sport').equals('Tennis')
".
  • Loading branch information
lopezac authored and Himanshu Garg committed Sep 27, 2022
1 parent b4e2afd commit 5f60751
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions files/en-us/learn/server-side/express_nodejs/mongoose/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,14 @@ query.exec((err, athletes) => {
Above we've defined the query conditions in the `find()` method. We can also do this using a `where()` function, and we can chain all the parts of our query together using the dot operator (.) rather than adding them separately. The code fragment below is the same as our query above, with an additional condition for the age.

```js
Athlete.
find().
where('sport').equals('Tennis').
where('age').gt(17).lt(50). // Additional where query
limit(5).
sort({ age: -1 }).
select('name age').
exec(callback); // where callback is the name of our callback function.
Athlete
.find()
.where('sport').equals('Tennis')
.where('age').gt(17).lt(50) // Additional where query
.limit(5)
.sort({ age: -1 })
.select('name age')
.exec(callback); // where callback is the name of our callback function.
```

The [find()](https://mongoosejs.com/docs/api.html#query_Query-find) method gets all matching records, but often you just want to get one match. The following methods query for a single record:
Expand Down

0 comments on commit 5f60751

Please sign in to comment.