O
O
Oleg Evdokimov2018-12-15 19:54:01
MongoDB
Oleg Evdokimov, 2018-12-15 19:54:01

Is there an analogue of mysql query in MongoDB?

I need to output and group the first letters of existing entries for an alphabetical index.
In mysql, this question solved the query, how to do the same in MongoDB?

SELECT 
  SUBSTRING(`Name` FROM 1 FOR 1 ) as prefix 
FROM 
  `table` 
GROUP BY 
  prefix 
ORDER BY prefix

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question