Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MongoError: Unknown modifier: $pushAll , add nodemon and improve readme #1

Merged
merged 1 commit into from Nov 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 42 additions & 1 deletion README.md
Expand Up @@ -10,4 +10,45 @@
## Some stuff that I will add later
* Ability for the employees to search for their names
* Some administrative work route. for the manager
* Data visualizations using d3.js (bar, charts, heat maps, nodes) etc. d3.js remains the best in-browser data visualization library.
* Data visualizations using d3.js (bar, charts, heat maps, nodes) etc. d3.js remains the best in-browser data visualization library.


## Requirements

- Node.js
- Mongo (You can follow this guide to get mongo with docker https://gist.github.com/jrichardsz/3f5ab6cffb2a4393fda331315469ad83)

## Getting started

- start a mongo database process

- expose environment variables
```
export DATABASE=localhost
export port=9000
export SECRET=1e1df736
```
- install libraries
```
npm install
```
- start in dev mode
```
npm run dev
```

- You must see this log:

```
Server is up and running
Connection to database was succesful
```

Other logs could be indicate an error.


## Home Page

Point your browser at http://localhost:9000 and you will be see something like:

![demo](https://image.ibb.co/jK6WaA/demo.gif)
14 changes: 8 additions & 6 deletions models/user.js
Expand Up @@ -2,7 +2,7 @@ const mongoose = require('mongoose');
mongoose.Promise = global.Promise;
const userSchema = new mongoose.Schema({
name:{
type:String,
type:String,
required:'You must supply a name',
trim:true
},
Expand All @@ -13,17 +13,19 @@ const userSchema = new mongoose.Schema({
default:Date.now,
},
entry:{type:Date},
exit:{
exit:{
time:{
type:Date
},
// 1 - General
// 2 - Vacation
// 3 - Doctor
reason:Number
}
reason:Number
}

}]
}, {
usePushEach: true
})

module.exports = mongoose.model('User',userSchema);
module.exports = mongoose.model('User',userSchema);