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

event on remove document #52

Closed
Tobino opened this issue Feb 12, 2017 · 2 comments
Closed

event on remove document #52

Tobino opened this issue Feb 12, 2017 · 2 comments

Comments

@Tobino
Copy link

Tobino commented Feb 12, 2017

Hi everyone,

While I am trying to remove a document from a collection, Rxdb don't emit any change.
Example :

var col;
RxDB.create('heroesDB', 'memory')      // create database
	.then(function (db) { return db.collection('mycollection', mySchema); }) // create collection
	.then(function (collection) {
		col = collection;
		collection
			.find()
			.$ // <- returns observable of query
			.subscribe(docs => {
				if (docs) {
					console.dir(docs); // change
				}
			});
		collection.insert({users: [{name: 'one'}, {name: 'two'}]});
		return collection;
	}).then((collection) => {
		collection.findOne({users: {$eq: [{name: 'one'}, {name: 'two'}]}}).exec()
			.then(documents => {
				if (documents) {
					console.log('remove');
					documents.remove();
				};
			});
		return collection;
	}).then((collection) => {
		setTimeout(function () {
			col.insert({users: [{name: 'three'}, {name: 'four'}]});
		}, 1000);
	});

output :

Array[1] // change
remove
Array[1] // change

I was expecting a change on remove, with a 0 lenght document.

@salomonelli
Copy link
Contributor

Error should be fixed with PR.

pubkey added a commit that referenced this issue Feb 12, 2017
FIX bug #52 query.$ fires on remove
@pubkey
Copy link
Owner

pubkey commented Feb 12, 2017

Fixed in version 2.0.4.
Please upgrade.

@pubkey pubkey closed this as completed Feb 12, 2017
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

3 participants