It sounds like you actually were arrested, technically speaking. If you saw the judge, the officer must have given you a piece of paper telling you when to show up. This was probably a summons, much like you might receive for a speeding ticket.
The first offender program is provided to people against whom the Court has already found facts sufficient to convict. When you successfully complete it the court dismisses the charge.
Expungement for a first-offender dismissal is not available in Virginia for two reasons: 1.) The expungement statute prohibits relief to people for whom evidence was found to be sufficient, and 2.) They want to keep the dismissal on your record so that you only get the first-offender opportunity once.
Your NCIC (criminal) record likely shows an arrest/charge for possession of marijuana and a disposition of "dismissed." Under current law that will stay on your record forever. But it's not a conviction.