Start a new topic

Bug: modules.collectionAccess.collection update() with $inc is broken

Attempting to increment/decrement using modules.collectionAccess.collection update() with $inc returns the following error:



{

"error": "BLRuntimeError",

"description": "The Business Logic script has a runtime error. See debug message for details.",

"debug": "TypeError: Cannot read property 'multi' of undefined"

}

Can you provide the actual call you are making?
collection.update( { _id: photoId }, { $inc: { likes_count: 1 } } );
You need to include either options or a callback with your update. The format for the update command is update(query, entity, options, callback) or update(query, entity, options), or update(query, entity, callback). update(query, entity) is not currently supported.
Thanks that fixed the issue. Just out of curiosity, that code was working earlier this week (when count was broken). Did something change?
It did change, but it is never a good idea not to include a callback as Mongodb does not behave properly if a callback is not included.
Login or Signup to post a comment