daily pastebin goal
82%
SHARE
TWEET

Untitled

a guest Dec 18th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const conn = require('./connect');
  2. let Student= require('./models/Student.js')
  3.  
  4.  
  5. conn.connect();
  6.  
  7. Student.update(
  8.     //ensin kriteerit
  9.     {
  10.     student_code: 'L5114',
  11.     grades: {course_code: 'HK2018'}
  12.     },
  13.  
  14.     //sitten miksikä asiat muutetaan
  15.     //$push: jälkeen tulee muutokset. grades: määrittää alidokumentin
  16.     {$set : {'grades.$.grade': 2 }},
  17.  
  18.     //äks dee
  19.     function (err, rows_updated) {
  20.         if (err) {
  21.             throw err
  22.         }
  23.         //console.log(rows_updated); //katsotaan millainen on rows_updated -olio
  24.         console.log(rows_updated.n + ' siinähän se');
  25.     }
  26. )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top