Irrelon/ForerunnerDB

Support for $not operator

Closed this issue · 3 comments

Hi, we've come across the need to use the $not operator, which FDB currently doesn't support and I cannot find a viable alternative using the operators that it does support.
I'm trying to avoid using two queries to achieve the same effect.

Here's a simplified use case.
I have a list of users which have a list of groups they are a part of.
I need to query a list of users that are not a part of a given group.

var col = db.collection('test');
col.insert({
	_id: 1, 
	name: 'John Doe', 
	group: [{
		name: 'groupOne'
	}, {
		name: 'groupTwo'
	}]
})
col.insert({
	_id: 2, 
	name: 'Jane Doe', 
	group: [{
		name: 'groupTwo'}
	]
});

// find members who are not a part of 'groupOne'
// result should be 'Jane Doe' as she's only a part of 'groupTwo'
col.find({
	$not: {
		group: {
			name: 'groupOne'
		}
	}
})

Hi ya, I have added the $not operator and pushed a new version 2.0.21-dev of ForerunnerDB on the dev branch. Can you take a look and let me know if it works as you expect? If so I will merge to production for you.

Sorry for the slow response.
Indeed the query with $not operator works like a charm.
I also checked the commit and is exactly what is expected from the $not operator.

Thank you for the fast turnaround!

image

Wonderful, I'll merge to master and release a new version. Cheers!