.where()
Specify a where clause for filtering a query.
.where(whereClause)
Arguments | Type | Details | |
---|---|---|---|
1 | whereClause | The where clause to use for matching records in the database. |
To find all the users named Finn whose email addresses start with 'f':
var users = await User.find()
.where({ name: 'Finn', 'emailAddress' : { startsWith : 'f' } });
return res.json(users);
The criteria provided in the
.where()
method takes precendence over the the criteria provided in.find()
.
The
.find()
method returns a chainable object if you don't supply a callback. This method can be chained to.find()
to further filter your results.