Suppose I have two dstore collections: value1 and value2.
I want to find out what items are in value1 but not in value2. So something like this:
var filterCollection = value1.filter(function(item) {
return value2.notExists(item);
});
But "notExists" function, well, doesn't exist. How do I make this logic work?
As this feature is not included by default in
dstore
, you can write your own function for comparing the content of yourdstores
and use the result as you wish.Here a generic example. You need to populate
value1
andvalue1
with the content of yourdstore
.Simplified example.
http://jsbin.com/fozeqamide/edit?html,console,output
Version without using indexOf()
http://jsbin.com/nihelejodo/edit?html,console,output
The way how you loop in your
datastore
is related to its data structure.Notes: This is a generic example as the question does not provide any source code, nor an example of data in
dstore
.