Query
> use s27_events
- SELECT * FROM Profile
db.Profile.find ({}) - SELECT * FROM Profile WHERE Name = "Chamith"
db.Profile.find({Name:"Chamith"}) - SELECT * FROM Profile WHERE Name = "Chamith" AND Dob = "1988-01-24" AND Setting.Security._2fa = false
db.Profile.find({Name:"Chamith",Dob:"1988-01-24",Setting:{Security:{_2fa:false}}})
Update
update/add a new field to the collection
db.Profile.update({},{$set:{ProfileImage:"chamith.png"}})
db.Profile.update({},{$unset:{ProfileImage:"chamith.png"}})
db.Profile.update({},{$set:{ProfileImage:[{Url:"chamith1",IsDefault:false},{Url:"chamith2",IsDefault:true}]}})
db.Profile.update({},{$set:{Setting:{Security:{ _2fa:false}}}})
db.Profile.update({_id:ObjectId('628cae92a72e5e4316a8a8a5')},{$set:{Setting:{Preferences:{Country:"Sri Lanka",Currency:"LKR"},Security:{_2fa:true}}}})
No comments:
Post a Comment