title: Querying MongoDb's custom key & value with Index
body: <p>I am trying to store key value data in MongoDb. 
  <strong>Key</strong> could be any string and I don't know about it anything more before storing, <strong>value</strong> could be any type (int, string, array). And I would like to have an index on such <strong>key</strong> &amp; <strong>value</strong>.</p>
  
  <p>I was looking on a (<a href="https://docs.mongodb.com/manual/core/index-multikey/" rel="nofollow noreferrer">Multikey Index</a>) over an array of my <strong>key-vals</strong> but looks like it can't cover queries over array fields. </p>
  
  <p>Is it possible to have an index on a custom <strong>key</strong> &amp; <strong>value</strong> in mongoDb and make queries with such operations as $exists and $eq and $gte, $lte, $and, $or, $in without COLLSCAN but through an IXSCAN stage?
  Or maybe I need another Db for that?</p>