Manage tree structures in MongoDB