If you want to play with an embedded persistent database for Node.js, you might find what you’re looking for in NeDB.
Chatriot says you can think of NeDB as a SQLite for Node.js projects, which can be used with a simple require statement. You can use it as a persistent or an in-memory only datastore. One datastore is the equivalent of a MongoDB collection.
NeDB does support indexing, and you can index any field, including fields in nested documents using the dot notation. For now, indexes are only used to speed up basic queries and those using $in, $lt, $lte, $gt and $gte.
The description on GitHub says that
“NeDB is not intended to be a replacement of large-scale databases such as MongoDB! Its goal is to provide you with a clean and easy way to query data and persist it to disk, for web applications that do not need lots of concurrent connections, for example a continuous integration and deployment server and desktop applications built with Node Webkit.”
Chatriot says he’s benchmarked NeDB against TaffyDB and NeDB is much, much faster, so he’s planning on porting it to browsers.