PoloDB: Can not update collection UnknownUpdateOperation(...)

collection
    .update(
        Some(&mk_document! { "_key": key_name }),
        &mk_document! { "value": value },
    )
    .unwrap();
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnknownUpdateOperation("value")', src/db.rs:143:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I want to update the entry with the “_key” as key_name’s value field, however, it displays the above error. any help?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 30

Commits related to this issue

Most upvoted comments

Use newer version will be more safe:

polodb_core = "0.10.2"
polodb_bson = "0.10.2"

It’s about database initiation.

Thank you very much. I will impliment this later. You may also want to add a warning to the readme to not access a database in this way to prevent corruption.

I’ve reproduced successfully, I’ll see what happened.

I will soon.

You need to specific the update operation, so try:

collection
    .update(
        Some(&mk_document! { "_key": key_name }),
        &mk_document! {
          "$set": &mk_document! {
             "value": value
          }
       },
    )

Other operation can be found at docs/en-US/Update.md