Advertisement
Guest User

Untitled

a guest
Jul 12th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.97 KB | None | 0 0
  1. var subSchoolSchema = mongoose.Schema({
  2. schoolid: String,
  3. username: String,
  4. password: String,
  5. departments: [{
  6. name: String,
  7. hod: String,
  8. duration: Number,
  9. classes: [{
  10. title: String,
  11. students: [{
  12. schId: String,
  13. firstname: String,
  14. lastname: String,
  15. othername: String,
  16. password: String,
  17. email: String,
  18. group: String,
  19. issues: Array,
  20. notes: String,
  21. chatId: String,
  22. fcm_token: String,
  23. state: Number,
  24. type: Number,
  25. suspended: Boolean,
  26. details: [{
  27. key: String,
  28. value: String
  29. }],
  30. courses: [{
  31. title: String,
  32. code: String,
  33. credit: Number,
  34. instructor: String,
  35. instructorId: String,
  36. score: Number
  37. }],
  38. img: {
  39. type: String,
  40. default: "svg/icon_student_sync_dp.svg"
  41. }
  42. }]
  43. }]
  44. }]
  45. })
  46.  
  47. var stud = { schId: id, firstname: fname, lastname: lname, othername: othername, email: email, group: grp, password: password, state: 2, type: 0, img: dp, details: details }
  48. subschool.update({ username: request.session.code, "departments.classes._id": studentClass }, {
  49. "$push": {
  50. "departments.classes.students" : stud
  51. }
  52. }, function (er, result) {
  53. if(er){
  54. console.log(er)
  55. } else {
  56. res.end('{"status" : 0,"success":1}')
  57. }
  58. }
  59.  
  60. { CastError: Cast to [number] failed for value "[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password"
  61. :"7f6f5e9d","state":2,"type":0,"img":"svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]" at path "student
  62. s"
  63. at MongooseError.CastError (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooseliberrorcast.js:26:11)
  64. at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:184:15)
  65. at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:195:15)
  66. at castUpdateVal (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:266:22)
  67. at walkUpdatePath (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:143:22)
  68. at castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:71:18)
  69. at Query._castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2902:10)
  70. at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2752:23)
  71. at Query.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2547:10)
  72. at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2448:16)
  73. at Function.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2364:10)
  74. at C:UsersUSERDocumentsProjectsSchool Syncikeyroutesstudentsstudentapi.js:33:15
  75. at Query.<anonymous> (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:3800:16)
  76. at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:277:21
  77. at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:131:16
  78. at _combinedTickCallback (internal/process/next_tick.js:73:7)
  79. message: 'Cast to [number] failed for value "[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":
  80. "7f6f5e9d","state":2,"type":0,"img":"svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]" at path "students
  81. "',
  82. name: 'CastError',
  83. stringValue: '"[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":"7f6f5e9d","state":2,"type":0,
  84. "img":"svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]"',
  85. kind: '[number]',
  86. value: '[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":"7f6f5e9d","state":2,"type":0,"img":"
  87. svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]',
  88. path: 'students',
  89. reason:
  90. { CastError: Cast to number failed for value "{ schId: 'nj122',
  91. firstname: 'djnk',
  92. lastname: 'jjkn',
  93. othername: 'kn',
  94. email: 'inei@iiu.edn',
  95. group: 'B',
  96. password: '7f6f5e9d',
  97. state: 2,
  98. type: 0,
  99. img: 'svg/icon_student_sync_dp.svg',
  100. details:
  101. [ { key: 'Gender', value: 'Male' },
  102. { key: 'Blood Type', value: 'V0' } ] }" at path "students"
  103. at MongooseError.CastError (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooseliberrorcast.js:26:11)
  104. at SchemaNumber.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemanumber.js:231:9)
  105. at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:180:34)
  106. at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:195:15)
  107. at castUpdateVal (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:266:22)
  108. at walkUpdatePath (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:143:22)
  109. at castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:71:18)
  110. at Query._castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2902:10)
  111. at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2752:23)
  112. at Query.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2547:10)
  113. at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2448:16)
  114. at Function.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2364:10)
  115. at C:UsersUSERDocumentsProjectsSchool Syncikeyroutesstudentsstudentapi.js:33:15
  116. at Query.<anonymous> (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:3800:16)
  117. at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:277:21
  118. at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:131:16
  119. message: 'Cast to number failed for value "{ schId: 'nj122',n firstname: 'djnk',n lastname: 'jjkn',n othername: 'kn',n email: 'inei@iiu.edn',
  120. n group: 'B',n password: '7f6f5e9d',n state: 2,n type: 0,n img: 'svg/icon_student_sync_dp.svg',n details: n [ { key: 'Gender', value: 'Male'
  121. },n { key: 'Blood Type', value: 'V0' } ] }" at path "students"',
  122. name: 'CastError',
  123. stringValue: '"{ schId: 'nj122',n firstname: 'djnk',n lastname: 'jjkn',n othername: 'kn',n email: 'inei@iiu.edn',n group: 'B',n password
  124. : '7f6f5e9d',n state: 2,n type: 0,n img: 'svg/icon_student_sync_dp.svg',n details: n [ { key: 'Gender', value: 'Male' },n { key: 'Blood Type
  125. ', value: 'V0' } ] }"',
  126. kind: 'number',
  127. value:
  128. { schId: 'nj122',
  129. firstname: 'djnk',
  130. lastname: 'jjkn',
  131. othername: 'kn',
  132. email: 'inei@iiu.edn',
  133. group: 'B',
  134. password: '7f6f5e9d',
  135. state: 2,
  136. type: 0,
  137. img: 'svg/icon_student_sync_dp.svg',
  138. details: [Object] },
  139. path: 'students',
  140. reason: undefined } }
  141. { username: 'AA',
  142. 'departments.classes._id': '59669687abf46f170045cc6e' }
  143. { CastError: Cast to [number] failed for value "[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password"
  144. :"7f6f5e9d","state":2,"type":0,"img":"svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]" at path "student
  145. s"
  146. at MongooseError.CastError (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooseliberrorcast.js:26:11)
  147. at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:184:15)
  148. at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:195:15)
  149. at castUpdateVal (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:266:22)
  150. at walkUpdatePath (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:143:22)
  151. at castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:71:18)
  152. at Query._castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2902:10)
  153. at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2752:23)
  154. at Query.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2547:10)
  155. at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2448:16)
  156. at Function.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2364:10)
  157. at C:UsersUSERDocumentsProjectsSchool Syncikeyroutesstudentsstudentapi.js:33:15
  158. at Query.<anonymous> (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:3800:16)
  159. at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:277:21
  160. at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:131:16
  161. at _combinedTickCallback (internal/process/next_tick.js:73:7)
  162. message: 'Cast to [number] failed for value "[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":
  163. "7f6f5e9d","state":2,"type":0,"img":"svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]" at path "students
  164. "',
  165. name: 'CastError',
  166. stringValue: '"[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":"7f6f5e9d","state":2,"type":0,
  167. "img":"svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]"',
  168. kind: '[number]',
  169. value: '[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":"7f6f5e9d","state":2,"type":0,"img":"
  170. svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]',
  171. path: 'students',
  172. reason:
  173. { CastError: Cast to number failed for value "{ schId: 'nj122',
  174. firstname: 'djnk',
  175. lastname: 'jjkn',
  176. othername: 'kn',
  177. email: 'inei@iiu.edn',
  178. group: 'B',
  179. password: '7f6f5e9d',
  180. state: 2,
  181. type: 0,
  182. img: 'svg/icon_student_sync_dp.svg',
  183. details:
  184. [ { key: 'Gender', value: 'Male' },
  185. { key: 'Blood Type', value: 'V0' } ] }" at path "students"
  186. at MongooseError.CastError (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooseliberrorcast.js:26:11)
  187. at SchemaNumber.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemanumber.js:231:9)
  188. at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:180:34)
  189. at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:195:15)
  190. at castUpdateVal (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:266:22)
  191. at walkUpdatePath (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:143:22)
  192. at castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:71:18)
  193. at Query._castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2902:10)
  194. at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2752:23)
  195. at Query.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2547:10)
  196. at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2448:16)
  197. at Function.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2364:10)
  198. at C:UsersUSERDocumentsProjectsSchool Syncikeyroutesstudentsstudentapi.js:33:15
  199. at Query.<anonymous> (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:3800:16)
  200. at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:277:21
  201. at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:131:16
  202. message: 'Cast to number failed for value "{ schId: 'nj122',n firstname: 'djnk',n lastname: 'jjkn',n othername: 'kn',n email: 'inei@iiu.edn',
  203. n group: 'B',n password: '7f6f5e9d',n state: 2,n type: 0,n img: 'svg/icon_student_sync_dp.svg',n details: n [ { key: 'Gender', value: 'Male'
  204. },n { key: 'Blood Type', value: 'V0' } ] }" at path "students"',
  205. name: 'CastError',
  206. stringValue: '"{ schId: 'nj122',n firstname: 'djnk',n lastname: 'jjkn',n othername: 'kn',n email: 'inei@iiu.edn',n group: 'B',n password
  207. : '7f6f5e9d',n state: 2,n type: 0,n img: 'svg/icon_student_sync_dp.svg',n details: n [ { key: 'Gender', value: 'Male' },n { key: 'Blood Type
  208. ', value: 'V0' } ] }"',
  209. kind: 'number',
  210. value:
  211. { schId: 'nj122',
  212. firstname: 'djnk',
  213. lastname: 'jjkn',
  214. othername: 'kn',
  215. email: 'inei@iiu.edn',
  216. group: 'B',
  217. password: '7f6f5e9d',
  218. state: 2,
  219. type: 0,
  220. img: 'svg/icon_student_sync_dp.svg',
  221. details: [Object] },
  222. path: 'students',
  223. reason: undefined } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement