In MongoDB how to convert the existing string attribute value "abc-1" with "abc-0001".
For example I have a collection as shown below
[ { "id":"abc-1", "name":"Smith" }, { "id":"abc-2", "name":"John" }... ]
the above collection should update as follows
[ { "id":"abc-0001", "name":"Smith" }, { "id":"abc-0002", "name":"John" }... ]
Thanks in Advance
Simply say, needs to split the string and leading with 0's