The following is using nodejs
, expressjs
, mongodb
. On the live site it is using mongolab
. I am making a POST
request from the front end to the server, and the server handles the request by deleting a single matching record from the database. The server work (done in ExpressJS
is as follows:
var removeStuff = req.body.removeStuff;
var currentId = req.user._id;
var currentEmail = req.user.email;
myStuff.findOne({
$and: [
{ $or: [{stuff: removeStuff}] },
{ $or: [{apid:currentId},{apiemail:currentEmail}] }
]
}, function (err, currentStuff) {
currentStuff.remove();
res.send('Stuff was removed from database...')
});
What's really strange is that this works perfectly for the site when I'm running it on localhost
. But when it's live, making the request removes ALL records from the database.