arunoda / meteor-smart-collections

Meteor Collections Re-Imagined
MIT License
147 stars 13 forks source link

update return error and affected count undefined #44

Open rodmanlu opened 10 years ago

rodmanlu commented 10 years ago

i try to update collection with Meteor.Collection ( even with async callback function ) , the return error and count is correct always. but when i replace Meteor.Collection with Meteor.SmartCollection . all return value change to 'undefined' . what can i do ? or this is bug ?

arunoda commented 10 years ago

Can you demonstrate this with a sample code. Then I can get a better understanding of the issue.

rodmanlu commented 10 years ago

case 1 sync ( n1 is undefined with Smart Collection): n1 = stkbasic.update({ _id: stk._id }, { $set: one } );
console.log('update id: ' + stk.code + ' - ' + n1 );

case 2 sync ( n2 is undefined with Smart Collection): up={}; up['y']=year; up[fld]=val; n2 = stkbasic.update( { _id: stkId }, { $addToSet : { years : up } }); console.log('update n2:' + n2);

case 3 async ( err and count are undefined with Smart Collection): stkbasic.update( { _id: stkId, month: {$elemMatch: { m : d } } }, { $set : u }, function(err, count){

                                 console.log('count:' + count + ', err:' + err);    

                              } );
arunoda commented 10 years ago

Not I got the issue. Yes it is undefined. It's not a bug simply I forgot to implement it. Will do it.

arunoda commented 10 years ago

Okay, I've released a new version(0.3.23) It has the fix.

rodmanlu commented 10 years ago

thanks. but the version 0.3.23 worked when update successfully. still return undefined if update fail not value 0