title: Mongodb(4.2.3) substr in nested objects
body: <p>I need add value in array of nested objects which is substring one of their part.</p>
  <p>Structure of collection:</p>
  <pre><code>Car {
   &quot;_id&quot;: &quot;6185261a5d825f31317e8712&quot;,
   &quot;functions&quot;: [
      {&quot;function&quot;: &quot;f1&quot;, &quot;name&quot;: &quot;heating&quot;, &quot;additionalInfo&quot;: {&quot;url&quot;: &quot;f1.opel/astra/heat.x3&quot;}},
      {&quot;function&quot;: &quot;f2&quot;, &quot;name&quot;: &quot;turbo&quot;,  &quot;additionalInfo&quot;: {&quot;url&quot;: &quot;f2.opel/astra/turbo.v388&quot;}}]
  }
  </code></pre>
  <p>I prepared some script which create new field</p>
  <pre><code>db.car.updateMany
  (
      {&quot;functions.additionalInfo&quot;: { $exists: true}},
      [{ $set: {&quot;functions.additionalInfo.infoName&quot; : &quot;xxx&quot; }}]
  )
  </code></pre>
  <p>But when I start using string operations it fails. I need crate infoName which should be content after last slash of url. I have issue with last index and string operations but below have some start idea.</p>
  <pre><code>db.feedback.updateMany
  (
      {&quot;functions.additionalInfo&quot;: { $exists: true}},
      [{ $set: {&quot;function.additionalInfo.name&quot;:{
          $substrBytes: [
              &quot;function.additionalInfo.url&quot;,
              {$strLastIndex : [&quot;function.additionalInfo.url&quot;, '/'],}, /* TODO */
              {$strLenCP: &quot;function.additionalInfo.url&quot;} ]
             }}}]
  )
  </code></pre>
  <p>And I need update all nested additional info in each function if exists. I need this result</p>
  <pre><code>Car {
   &quot;_id&quot;: &quot;6185261a5d825f31317e8712&quot;,
   &quot;functions&quot;: [
      {&quot;function&quot;: &quot;f1&quot;, &quot;name&quot;: &quot;heating&quot;, &quot;additionalInfo&quot;: {&quot;url&quot;: &quot;f1.opel/astra/heat.x3&quot;, &quot;infoName&quot;: &quot;heat.x3&quot;}},
      {&quot;function&quot;: &quot;f2&quot;, &quot;name&quot;: &quot;turbo&quot;,  &quot;additionalInfo&quot;: {&quot;url&quot;: &quot;f2.opel/astra/turbo.v388&quot;, &quot;infoName&quot;: &quot;turbo.v388&quot;}}]
  }
  </code></pre>
  <p>Thanks a lot.</p>