Javascript arrays with MongoDB-like indexing