I'm trying to find a database that meets a set of criteria with little luck. What I want are pretty much all the features of MonoDB, except I don't want to install it or run a server (more like how Sqlite works).

My requirements are:

* Stored objects are a collection of key-value pairs. Not every key will be used by every object and as time goes on more keys will be added. The ability to store lists or sets as values would be a nice to have but is not critical.

* Queries will be on the order of "find all documents where key-x = value-x and key-y < value-y". I don't need more complex queries like aggregation or joins.

* The database is embedded. I.e. rather than running a server, the client just opens the database file, performs its queries, then closes it. I would prefer if it needed only a single file like sqlite, but wouldn't mind too much having to manage a directory.

* There are bindings for Perl or Haskell (or C--I'll write the wrapper if I need to).

I've experimented using an SQL database with a table format like
Code:
ID    KEY    VALUE
0000  Color  Red
0000  Shape  Square
0001  Color  Blue
0001  Shape  Triangle
0001  Size   Large
And use joins to pick out the keys I want. It works, but the queries are kind of awkward and I feel like I'm doing something wrong.

Does anyone know of a better alternative?