Uploaded image for project: 'Rust Driver'
  1. Rust Driver
  2. RUST-940

update_one: The dollar ($) prefixed field is not valid for storage

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      Sample Code:

      Unable to find source-code formatter for language: rust. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      let sequence = format!("locations.{}.options", data.location_id);
        let p_sequence = format!("$locations.{}.options", data.location_id);
        let update_result = db
          .collection("enquiries")
          .update_one(
            doc! { "_id": &data._id },
            doc! {
              "$set": {
                sequence: doc! {
                  "$concatArrays": [
                    {"$slice":[ &p_sequence, data.option_id ]},
                    {"$slice":[ &p_sequence, { "$add":[1, data.option_id]}, {"$size": &p_sequence}]}
                  ]
                }
              }
            },
            None,
          )
          .await?;
      

      Resulting Error:

      Err(
          Error {
              kind: WriteError(
                  WriteError(
                      WriteError {
                          code: 52,
                          code_name: None,
                          message: "The dollar ($) prefixed field \'$concatArrays\' in \'locations.0.options.$concatArrays\' is not valid for storage.",
                      },
                  ),
              ),
              labels: [],
          },
      )
      

            Assignee:
            isabel.atkinson@mongodb.com Isabel Atkinson
            Reporter:
            crystalflow.mwangi@gmail.com Samuel Mwangi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: