title: Using IndexedDB Like SQL. Query with multiple index values that are not in a range
body: <p>Basically I want to select all values that match the index/key but they are not in a range programmatically. It'd have to be able to select a range of requests(as in a variable amount at a time). In SQL I'd do it like this.</p>
  
  <pre><code>Select * FROM questions WHERE `id` in (2,45,17)
  
  </code></pre>
  
  <p>But when it comes indexedDB my options seem limited. I found that I can do multiple requests in series but how would I do that without already knowing how many are going to be chosen before hand?</p>
  
  <p>Here's the current JavaScript I am utilizing. Obviously this doesn't work. I have already created an indexedDB database named "practice_materials", created an objectstore named "questions", made the index by id, and put data into it.</p>
  
  <pre><code>window.idb=window.indexedDB;
       var request=indexedDB.open(db_name,db_version);
  request.onerror=function(event){
      console.log('error:'+event);
  }
  request.onsuccess=function(event){
    db_res=request.result;
  }
  var tx=db_res.transaction([obj_store]).objectStore(obj_store);
  var res='';     
  var out_obj=[];
  var id=[2,45,17];
  for(i=0;i&lt;3;++i){
      request=tx.get(id[i]);
      request.onsuccess=function(event){
      out_obj.push(request.result);
      }
  }
  </code></pre>
  
  <p>To any future people who come across this question. utilize idb to get out of callback hell so that you can have your code wait until the database/other transactions are complete before you try to access it.</p>
  
  <p><a href="https://github.com/jakearchibald/idb" rel="nofollow noreferrer">https://github.com/jakearchibald/idb</a></p>
  
  <p>The only thing is you have to build it for your browser which is worth it to have promises and being able to wait until the transaction completes.(Primarily when opening the database, getting the indexes, selecting objectstore etc., the setting of data don't matter as much but it's still nice to have.
  P.S.
  I'm going to be utilizing this for a question &amp; answer system as a study aide for Anatomy students. It'll be selecting a random amount of questions from each chapter(that I've made) and the range will be from 15-25 with the questions being selected randomly. I would utilize WebSQL as I can probably do this a lot easier but it's been appreciated.</p>
  
  <p>P.P.S.
  Besides a +Rep for correct answer I'll include a link back to this question.</p>