ExportXMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Fixed
    • Priority: Unknown
    • 4.0.0, 3.11.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Rust Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Ongoing mongoac development highlighted a significant performance overhead attributed to Database::run_raw_command()'s return type being Result<Document> rather than Result<RawDocumentBuf>.

      Every reply document, whose size and complexity depends on the arbitrary command given to the function, is recursively-parsed in its entirety during conversion of the RawDocumentBuf (within RawCommandResponse) into Document. Database::run_raw_command() in its current form addresses this problem for the command parameter (as alternative to Database::run_command()), but not for the return value.

      Ultimately it may be worth considering extending the RawDocumentBuf-based behavior of run_raw*() API to their return types, not just their parameters, in a future major release. In the interim, this ticket proposes the addition of a feature-gated API instead, e.g.:

      impl Database {
          pub fn run_raw_command_2(&self, command: RawDocumentBuf) -> RunRawCommand<'_>
          { ... }
      }
      
      impl<'a> Action for RunRawCommand<'a> {
          async fn execute(self) -> Result<RawDocumentBuf>
          { ... }
      }
      

      Note: "runCursorCommand()" can avoid this intermediate Document conversion problem by using Cursor::with_type::<RawDocumentBuf>().

            Assignee:
            Abraham Egnor
            Reporter:
            Ezra Chung
            None
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: