- From: <bugzilla@jessica.w3.org>
- Date: Tue, 30 Apr 2013 02:07:41 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21836
--- Comment #5 from Kyaw Tun <kyawtun@yathit.com> ---
Suppose we have a record value of:
var human = {
taxon: 9606,
classification: ['Animalia', 'Mammalia', 'Primates'],
name: {
genus: 'Homo',
species: 'sapiens'
},
habitat: ['asia', 'americas', 'africa', 'europe', 'oceania']
}
store = db.createObjectStore('specie', {keyPath: 'taxon'});
store.createIndex('clade', 'classification', {multiEntry: true});
store.createIndex('habitat', 'habitat', {multiEntry: true});
store.createIndex('binomen', ['name.genus', 'name.species']);
The following composite index is used to list specie table. This is use case A.
store.createIndex('specie', ['classification', '.binomen'], {unique: true});
It should create a index value of
[['Animalia', 'Mammalia', 'Primates'], ['Homo', 'sapiens']]
The following composite index is used to query specific clad order by name.
This is use case B.
store.createIndex('clad-name', ['.clade', '.binomen']);
It should crate index values of
['Animalia', ['Homo', 'sapiens']]
['Mammalia', ['Homo', 'sapiens']]
['Primates', ['Homo', 'sapiens']]
The following composite index is used to query habitant and clad.
store.createIndex('clad-habitat', ['.clade', '.habitat', '.binomen');
It should crate index values of
['Animalia', 'africa', ['Homo', 'sapiens']]
['Animalia', 'asia', ['Homo', 'sapiens']]
['Animalia', 'americas', ['Homo', 'sapiens']]
['Animalia', 'europe', ['Homo', 'sapiens']]
['Animalia', 'oceania', ['Homo', 'sapiens']]
['Mammalia', 'africa', ['Homo', 'sapiens']]
['Mammalia', 'asia', ['Homo', 'sapiens']]
['Mammalia', 'americas', ['Homo', 'sapiens']]
['Mammalia', 'europe', ['Homo', 'sapiens']]
['Mammalia', 'oceania', ['Homo', 'sapiens']]
['Mammalia', 'africa', ['Homo', 'sapiens']]
['Primates', 'africa', ['Homo', 'sapiens']]
['Primates', 'asia', ['Homo', 'sapiens']]
['Primates', 'americas', ['Homo', 'sapiens']]
['Primates', 'europe', ['Homo', 'sapiens']]
['Primates', 'oceania', ['Homo', 'sapiens']]
Notice that the last two composite index is created using array keyPath
consisting of keyPath or index, in which it is argumented by a dot.
Sorry, previously I was referring only use case for A and B. Use case C is
interesting, but will not be common need.
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Tuesday, 30 April 2013 02:07:43 UTC