Open TomV opened 9 years ago
Given the dataset:
{"_id": 1, "name": "Joe", "tags": ['sailing', 'chess', 'whisky', 'cheese', 'football']} {"_id": 2, "name": "Jane", "tags": ['wine', 'cheese', 'ballet', 'opera']} {"_id": 3, "name": "Mary", "tags": ['sailing', 'wine', 'cheese', 'hiking']} {"_id": 4, "name": "Mike", "tags": ['hiking', 'chess', 'beer', 'wine', 'skiing', 'football']}
To find all the documents/people who have an interest in ALL of these 'sailing', 'wine', 'cheese', I can do this in mongo:
var query = db.find( { "tags": { $all: ['sailing', 'wine', 'cheese'] } });
But nedb does not support {$all: [array]}, so the alternative is to use $and, and repeat the field to check:
var query = db.find( { $and: [ {"tags": 'sailing'}, {"tags": 'wine'}, {"tags": 'cheese'} ] });
It would be more concise if the mogodb "$all" operator were supported. Louis - can you nudge me in the right direction to make write a patch to support this?
I need the same feature.. Is their any solution ?
@TomV what about your solution performance ?
Hi, any news on this one? This feature would be really nice, especially as MongoDb has it as well :)
Given the dataset:
To find all the documents/people who have an interest in ALL of these 'sailing', 'wine', 'cheese', I can do this in mongo:
But nedb does not support {$all: [array]}, so the alternative is to use $and, and repeat the field to check:
It would be more concise if the mogodb "$all" operator were supported. Louis - can you nudge me in the right direction to make write a patch to support this?