0

Is this possible to sort by pattern position in Mongo? E.g. lookig for school:

  1. school
  2. schoolgirl
  3. High school

Best regards!

Marek Marczak
  • 532
  • 8
  • 14

1 Answers1

0

I'll give you a hint.

Use indexOf to find the occurrence position

Then do conditional sort

It will sort you the way you want.

Please update the question/open new one with your attempts.

Gibbs
  • 21,904
  • 13
  • 74
  • 138