Fixed slice indexing for MongoDB backend.