This means, authorization is denied.
This means, authorization can't be completed due to something wrong in the client side.
| const mongoose = require("mongoose") | |
| const Schema = mongoose.Schema | |
| // Create Schema | |
| const UserSchema = new Schema({ | |
| name: { | |
| type: String, | |
| required: true, | |
| }, | |
| email: { |
| // get user when needed by this | |
| export const getUser = () => (dispatch, getState) => { | |
| // User loading | |
| dispatch({ type: "USER_LOADING"}) | |
| axios | |
| .get('/api/auth/user', tokenConfig(getState)) | |
| .then(res => { | |
| dispatch({ | |
| type: "USER_LOADED", |
As an example, when we write db.students.find() and then do a forEach() loop over it, we are increasing the cost of the process as what we're doing is:
forEach on our server to filter data we needTo avoid getting uncessary data and decrease the load on our server we can do requests specific to our needs, like these.
db.students.find({}, {name: 1, email: 0}) # values with 1 show up, 0 don't