Skip to content
New issue

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

the parent doc is removed, the related children doc is not removed. #17

Open
fangjj opened this issue Jan 13, 2019 · 5 comments
Open

the parent doc is removed, the related children doc is not removed. #17

fangjj opened this issue Jan 13, 2019 · 5 comments

Comments

@fangjj
Copy link

fangjj commented Jan 13, 2019

this.cursor(Authors.find(authorId), function (id, doc) {
  this.cursor(Books.find({authorId: id}), function (id, doc) {
    this.cursor(Comments.find({bookId: id}));
  });
});

when i remove authorId1, the publish authorId1 is removed on client. but the published authorId1's books and comments to client not is removed.
please help me out. thank you!

@fangjj
Copy link
Author

fangjj commented Jan 14, 2019

@lfades any idea about this?

@fangjj
Copy link
Author

fangjj commented Jan 19, 2019

@lfades any update, please

@lfades
Copy link
Owner

lfades commented Jan 19, 2019

Hello! I'm no longer supporting this package because of lack of time and of the current state of Meteor, but I'm going to try to answer the question, I don't think that the comments or books should be removed, the cursors are stopped in the server, but you can manually remove the documents from the cache in the client.

@fangjj
Copy link
Author

fangjj commented Jan 19, 2019

thank you for your reply. how to manually remove the documents from the cache in the client? just like this:

Authors.find(authorId).observeChanges({
	removed(id) {
		const bookIds = Books.find({authorId: id}).map(book => book._id);
		Books.remove(_id: {$in: bookIds});
		Comments.remove({bookId: {$in: bookIds}});
	}
})

Meteor platform is still alive, why you are running away meteor.

@lfades
Copy link
Owner

lfades commented Jan 19, 2019

it was a performance and scalability decision, my current stack is Next.js + Apollo / Node.

The solution you're using may work, if you can do it from the client using minimongo, that may be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants