-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo
52 lines (40 loc) · 1.34 KB
/
info
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
npm install -g yo
npm install -g generator-express (github.com/petecoop/generator-express)
run the command yo
db-engines.com
database (my_store, todo_mvc...)
-> collection (array) []
-> objects/documents {}
-> properties
show databases
mongod --port 27017 --dbpath "C:\MongoDB\data\db" // windows command to start mongodb
1) use <database_name>
use todo
2) db (--> todo)
3) db.users.insert( {new object} )
db.users.insert( { login: 'admin', email: '[email protected]', password: '1234567' })
db.users.find()
db.users.find({ email: '[email protected]' })
db.users.update( { login: 'admin' }, { $set : { password: 'qwerty' } } )
db.users.remove( { login: 'admin2' } )
2 collections
references / links / embed
Tasks <> Users
npm install mongodb --save
npm install bcrypt-nodejs --save
npm install bcrypt --save
else {
// CONNECT TO DATABASE
MongoClient.connect(url, function(err, db) {
assert.equal(null, err);
console.log("Connected correctly to server");
// CHOOSE COLLECTION
var collection = db.collection('users');
collection.findOne({fullname: fullname}, function(err, result) {
console.log(result.fullname)
// send HTML file populated with quotes here
});
});
if (
fullname == result.fullname
){