Professional Documents
Culture Documents
20MIA1002 NoSQL Lab 3
20MIA1002 NoSQL Lab 3
LAB ASSIGNMENT – 3
db.lab3.update({dept:'AIML'},{$set:{"subject.$[ele]":'ai'}},{multi:t
rue, arrayFilters:[{"ele":"dl"}]})
• Update the marks of students which are less than 50 as 50 for the given
student registration number.
db.lab3.update({reg:1002},{$set:{"marks.$[ele]":50}},{multi:true,
arrayFilters:[{"ele":{$lt:50}}]})
Used to update the values of an element across different indexes in the array.
• Create a .json file with 3 students details and name the file as your
registration_number.json. Then move the file to new collection in
mongodb through monogo import command. Make sure that
mongoimport command should be executed in normal command prompt
not inside the mongo shell.