question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$unset not working?

See original GitHub issue

I’m having a server side method with the following code:

let updateObj = (isTyping) ? {$set: {'profile.isTyping': 1}} : {$unset: {'profile.isTyping': ''}};
Meteor.users.update(Meteor.userId(), updateObj);

The problem is that redis-oplog doesn’t reflect that change, profile.isTyping is still available on the client side. redis-oplog sets it to null instead of removing it.

So I I do this on the client side:

 Meteor.users.findOne(this.foreignUser()).profile.hasOwnProperty('isTyping')

I will get always true, because the field isn’t removed. It works without problems on MongoDB + Oplog.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
theodorDiaconucommented, Mar 15, 2017

Oh my god. After squeezing my brains for 2 hours on this one I found it. When I’m overriding observeChanges I need to pass in a clone, not an object. Bc if I pass it as reference, publishComposite does not detect any changes here:

https://github.com/englue/meteor-publish-composite/blob/master/lib/subscription.js#L66

Nice bug. Solved. Will be available in 1.1.8 release

0reactions
theodorDiaconucommented, Mar 3, 2017

@dnish thank you for your detailed information. I have enough to fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

unset( ) not working PHP - Stack Overflow
unset ( ) not working PHP · You've got an array of names as values, but you're trying to use the value as...
Read more >
unset - Manual - PHP
It's sole purpose is to "unset" this variable, ie. to remove it from the current scope and destroy it's associated data. This is...
Read more >
Unset from array not working - PHP Coding Help
blmg2009. I'm wanting to remove the 5 and 3 from the array but the following isn't working: unset($list['5']); Can you only unset the...
Read more >
unset Not Working PHP Array - CodeProject
First, you are dumping $_SESSION["people"] in the "Before Array" and "After Array" blocks, but you are working with $people variable. Try to ...
Read more >
$unset not working · Issue #4992 · Automattic/mongoose
I ran mongoose in debug mode and saw following query, it doesn't have $unset field. sessions.update({ isDeleted: false, 'deviceDetails.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found