for error: "TypeError: index 'p_name' cannot be applied to Cursor instances" solution: replace find with find_one