I did it while shooting raw only, with no JPEG.
Before releasing the shutter
On my Nikon D7000, the monochrome setting can be configured as a Picture Control, so it is definitely applied to raw files. Once you have configured the setting, you can then fine tune it by applying one of the four color filters or you can configure no filter. Neither the manual nor the camera's built-in help screen explains what happens when you configure no filter. I wonder in that situation if the image is desaturated rather than converted. Naturally, as you convert the raw file using post-processing software, you can choose to continue with the monochrome rendition or not that was applied by the camera so long as the software is made by Nikon or effectively emulates Nikon's Picture Control settings.
After releasing the shutter
On my Nikon D7000, once the image has been captured, the post-processing capabilities built into the camera include changing the color image to black-and-white, sepia or cyanotype. These can be applied to the display of the raw file. However, unlike the above explanation, no color filters are available when changing to black-and-white. Neither the manual nor the help screen explains whether the image is desaturated or converted. As above, you can choose to continue with the black-and-white rendition or not when you convert the raw file using post-processing software.