We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm install mongoose@4.1.3 resolved the issue
this deleted a single car last week:
deleteModel(Car, '55e5f7d65ad322fc41eb1aaa');
var mongoose = require('mongoose'); var q = require('q');
//define simple schema mapped to "cars" collection in mongo var carSchema = mongoose.Schema({ make: {type:String, required:'Make is required!'} });
mongoose.model('Car', carSchema, 'cars');
//helper functions var getById = function(model, id) {
var deferred = q.defer(); try { model.findOne({_id:id}).exec(function(err, record) { deferred.resolve(record); }); } catch (error) { deferred.reject(error); } return deferred.promise;
};
var deleteModel = function(model, id) {
var deferred = q.defer(); getById(model, id).then(function(record) { //extra validation, because I couldn't figure out why collection was purging if (!record) { deferred.reject('failure finding id: ' + id); } else if (!record._id || record._id != id) deferred.reject('failure getting id: ' + id); { record.remove(function(err) { if(err) { deferred.reject(err.toString()); } else { deferred.resolve(record); } }); } }, deferred.reject); return deferred.promise;
The text was updated successfully, but these errors were encountered:
Heads up, this was fixed earlier today: 83929e8
Duplicate of: #3326 and #3325
Sorry, something went wrong.
Fixed in 4.1.5, upgrade please :)
No branches or pull requests
npm install mongoose@4.1.3 resolved the issue
this deleted a single car last week:
var mongoose = require('mongoose');
var q = require('q');
//define simple schema mapped to "cars" collection in mongo
var carSchema = mongoose.Schema({
make: {type:String, required:'Make is required!'}
});
mongoose.model('Car', carSchema, 'cars');
//helper functions
var getById = function(model, id) {
};
var deleteModel = function(model, id) {
};
The text was updated successfully, but these errors were encountered: