Replace a full stop in a string

I wonder if anyone can help me, I’m trying to group by a field but I want to ‘clean’ that field first by removing spaces, apostrophes, full stops etc but I can’t for the life of me work out how to replace a full stop, any ideas? This is what I’ve been doing in $project to remove spaces for example:

Example: ‘$replaceAll’: {
‘input’: ‘$name’,
‘find’: ’ ',
‘replacement’: ‘’

Hi @Anna_Cockle - Welcome to the community!

Could you provide the following:

  • Sample document(s)
  • The expected output
  • MongoDB version


Thank you, Jason! I’ve managed to solve my own problem :).

1 Like

Glad to hear it! Thanks for updating the thread :slight_smile: