Fixed documentId escaping

The elem._id should be escaped