senecajs / seneca-mongo-store

Node.js Seneca data storage plugin for MongoDB
MIT License
35 stars 42 forks source link

Timeout Error: How to remove using ID? #18

Closed web3rover closed 8 years ago

web3rover commented 9 years ago

Here is the code

seneca.add({role: "coupons-store", cmd: "delete"}, function(args, respond){
    var coupons = seneca.make$("coupons");
    coupons.remove$({id: args.id}, function(err, entity){
        if(err) return respond(error);

        respond(null, {value: true});   
    });
});

Seems like I am passing the ID wrong way. It gives timeout error. But the document gets deleted from the coupons collection.

Please help me to fix this.

chafnan commented 9 years ago

Have you tried to pass the id directly as a string and not as an object. Here is an example from the seneca docs:

var id = '...'
var foo_entity = seneca.make('foo')
foo_entity.remove$( id, function(err){ ... })
mcdonnelldean commented 8 years ago

This ^