.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({ name: 'Finn' })
.where({ 'emailAddress' : { startsWith : 'f' } });
return res.json(users);
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.