const myObject = { school: true, address: false };
const myArray = [];
myArray.push(myObject);
updateSchool(myArray);
function updateSchool(thisSchool) {
$.ajax
({
type: "POST",
url: '/update_school',
data: {
school: thisSchool,
},
}
})
within App.js:
app.post('/update_school', function(request, response) {
......
db.collection("School").updateOne({_id: request.session.username},{$set:
{School:request.body.school}}, function(err, result){
...... }
}
When storing boolean values in MongoDB, they are stored as strings like
[{school:"true", address:"false"}]
Can anyone assist me with the process of storing Boolean values in MongoDB properly? Thank you.