Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var subSchoolSchema = mongoose.Schema({
- schoolid: String,
- username: String,
- password: String,
- departments: [{
- name: String,
- hod: String,
- duration: Number,
- classes: [{
- title: String,
- students: [{
- schId: String,
- firstname: String,
- lastname: String,
- othername: String,
- password: String,
- email: String,
- group: String,
- issues: Array,
- notes: String,
- chatId: String,
- fcm_token: String,
- state: Number,
- type: Number,
- suspended: Boolean,
- details: [{
- key: String,
- value: String
- }],
- courses: [{
- title: String,
- code: String,
- credit: Number,
- instructor: String,
- instructorId: String,
- score: Number
- }],
- img: {
- type: String,
- default: "svg/icon_student_sync_dp.svg"
- }
- }]
- }]
- }]
- })
- var stud = { schId: id, firstname: fname, lastname: lname, othername: othername, email: email, group: grp, password: password, state: 2, type: 0, img: dp, details: details }
- subschool.update({ username: request.session.code, "departments.classes._id": studentClass }, {
- "$push": {
- "departments.classes.students" : stud
- }
- }, function (er, result) {
- if(er){
- console.log(er)
- } else {
- res.end('{"status" : 0,"success":1}')
- }
- }
- { CastError: Cast to [number] failed for value "[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password"
- :"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
- s"
- at MongooseError.CastError (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooseliberrorcast.js:26:11)
- at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:184:15)
- at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:195:15)
- at castUpdateVal (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:266:22)
- at walkUpdatePath (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:143:22)
- at castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:71:18)
- at Query._castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2902:10)
- at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2752:23)
- at Query.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2547:10)
- at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2448:16)
- at Function.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2364:10)
- at C:UsersUSERDocumentsProjectsSchool Syncikeyroutesstudentsstudentapi.js:33:15
- at Query.<anonymous> (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:3800:16)
- at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:277:21
- at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:131:16
- at _combinedTickCallback (internal/process/next_tick.js:73:7)
- message: 'Cast to [number] failed for value "[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":
- "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
- "',
- name: 'CastError',
- stringValue: '"[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":"7f6f5e9d","state":2,"type":0,
- "img":"svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]"',
- kind: '[number]',
- value: '[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":"7f6f5e9d","state":2,"type":0,"img":"
- svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]',
- path: 'students',
- reason:
- { CastError: Cast to number failed for value "{ schId: 'nj122',
- firstname: 'djnk',
- lastname: 'jjkn',
- othername: 'kn',
- email: 'inei@iiu.edn',
- group: 'B',
- password: '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"
- at MongooseError.CastError (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooseliberrorcast.js:26:11)
- at SchemaNumber.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemanumber.js:231:9)
- at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:180:34)
- at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:195:15)
- at castUpdateVal (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:266:22)
- at walkUpdatePath (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:143:22)
- at castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:71:18)
- at Query._castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2902:10)
- at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2752:23)
- at Query.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2547:10)
- at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2448:16)
- at Function.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2364:10)
- at C:UsersUSERDocumentsProjectsSchool Syncikeyroutesstudentsstudentapi.js:33:15
- at Query.<anonymous> (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:3800:16)
- at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:277:21
- at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:131:16
- message: 'Cast to number failed for value "{ schId: 'nj122',n firstname: 'djnk',n lastname: 'jjkn',n othername: 'kn',n email: 'inei@iiu.edn',
- 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'
- },n { key: 'Blood Type', value: 'V0' } ] }" at path "students"',
- name: 'CastError',
- stringValue: '"{ schId: 'nj122',n firstname: 'djnk',n lastname: 'jjkn',n othername: 'kn',n email: 'inei@iiu.edn',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' },n { key: 'Blood Type
- ', value: 'V0' } ] }"',
- kind: 'number',
- value:
- { schId: 'nj122',
- firstname: 'djnk',
- lastname: 'jjkn',
- othername: 'kn',
- email: 'inei@iiu.edn',
- group: 'B',
- password: '7f6f5e9d',
- state: 2,
- type: 0,
- img: 'svg/icon_student_sync_dp.svg',
- details: [Object] },
- path: 'students',
- reason: undefined } }
- { username: 'AA',
- 'departments.classes._id': '59669687abf46f170045cc6e' }
- { CastError: Cast to [number] failed for value "[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password"
- :"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
- s"
- at MongooseError.CastError (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooseliberrorcast.js:26:11)
- at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:184:15)
- at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:195:15)
- at castUpdateVal (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:266:22)
- at walkUpdatePath (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:143:22)
- at castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:71:18)
- at Query._castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2902:10)
- at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2752:23)
- at Query.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2547:10)
- at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2448:16)
- at Function.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2364:10)
- at C:UsersUSERDocumentsProjectsSchool Syncikeyroutesstudentsstudentapi.js:33:15
- at Query.<anonymous> (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:3800:16)
- at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:277:21
- at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:131:16
- at _combinedTickCallback (internal/process/next_tick.js:73:7)
- message: 'Cast to [number] failed for value "[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":
- "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
- "',
- name: 'CastError',
- stringValue: '"[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":"7f6f5e9d","state":2,"type":0,
- "img":"svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]"',
- kind: '[number]',
- value: '[{"schId":"nj122","firstname":"djnk","lastname":"jjkn","othername":"kn","email":"inei@iiu.edn","group":"B","password":"7f6f5e9d","state":2,"type":0,"img":"
- svg/icon_student_sync_dp.svg","details":[{"key":"Gender","value":"Male"},{"key":"Blood Type","value":"V0"}]}]',
- path: 'students',
- reason:
- { CastError: Cast to number failed for value "{ schId: 'nj122',
- firstname: 'djnk',
- lastname: 'jjkn',
- othername: 'kn',
- email: 'inei@iiu.edn',
- group: 'B',
- password: '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"
- at MongooseError.CastError (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooseliberrorcast.js:26:11)
- at SchemaNumber.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemanumber.js:231:9)
- at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:180:34)
- at SchemaArray.cast (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibschemaarray.js:195:15)
- at castUpdateVal (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:266:22)
- at walkUpdatePath (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:143:22)
- at castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibservicesquerycastUpdate.js:71:18)
- at Query._castUpdate (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2902:10)
- at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2752:23)
- at Query.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibquery.js:2547:10)
- at _update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2448:16)
- at Function.update (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:2364:10)
- at C:UsersUSERDocumentsProjectsSchool Syncikeyroutesstudentsstudentapi.js:33:15
- at Query.<anonymous> (C:UsersUSERDocumentsProjectsSchool Syncikeynode_modulesmongooselibmodel.js:3800:16)
- at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:277:21
- at C:UsersUSERDocumentsProjectsSchool Syncikeynode_moduleskareemindex.js:131:16
- message: 'Cast to number failed for value "{ schId: 'nj122',n firstname: 'djnk',n lastname: 'jjkn',n othername: 'kn',n email: 'inei@iiu.edn',
- 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'
- },n { key: 'Blood Type', value: 'V0' } ] }" at path "students"',
- name: 'CastError',
- stringValue: '"{ schId: 'nj122',n firstname: 'djnk',n lastname: 'jjkn',n othername: 'kn',n email: 'inei@iiu.edn',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' },n { key: 'Blood Type
- ', value: 'V0' } ] }"',
- kind: 'number',
- value:
- { schId: 'nj122',
- firstname: 'djnk',
- lastname: 'jjkn',
- othername: 'kn',
- email: 'inei@iiu.edn',
- group: 'B',
- password: '7f6f5e9d',
- state: 2,
- type: 0,
- img: 'svg/icon_student_sync_dp.svg',
- details: [Object] },
- path: 'students',
- reason: undefined } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement