mongo-jdbc-driver icon indicating copy to clipboard operation
mongo-jdbc-driver copied to clipboard

MongoshScriptEngine execute result instanceof xxxResult always return null

Open dajinglingpake opened this issue 3 years ago • 0 comments

MongoshScriptEngine execute result instanceof xxxResult return null Why is it null? It actually has results in mongosh.

I changed it so that it can always return the result.

  if (result instanceof VoidResult || result instanceof MongoShellUpdateResult || result instanceof BSONTimestampResult){
    return Util.ok(result._asPrintable());
  }else if (result instanceof DateResult || result instanceof DBRefResult || result instanceof InsertOneResult
          || result instanceof UUIDResult){
    return Util.ok(result.getValue().toString());
  }else {
    return Util.ok(result.getValue());
  }

dajinglingpake avatar Jan 05 '22 08:01 dajinglingpake