question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot query on strings in v5

See original GitHub issue
System.NotSupportedException: "Method CompareString not available to convert to BsonExpression (CompareString(x.Name, value(testLiteDB.MainWindow+_Closure$__0-0).$VB$Local_customer.Name, False))."

how to reproduce: just perform any kind of query (Query/Find/FindOne) on a string property, using Lambda-Epressions. works in v4.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
lbnascimentocommented, Feb 3, 2020

@BangL In C#, the equality operator is a “real” operator and the BsonMapper successfully converts it to a to an expression. However, in VB, the string equality operator is converted to a call to CompareString, and the BsonMapper doesn’t know what to do with it.

In previous versions of LiteDB, lambdas that were not sucessfully converted to expressions were stored and executed after the results were retrieved and mapped to object. However, this feature was removed in v5 due to performance issues - if you ran your query on a collection with 1 million entries, all of them would be retrieved before the lambda expression was executed, which is very inefficient.

This feature may be recreated in v5.1 in a more efficient way, however please note that there might be a significant performance hit.

0reactions
BangLcommented, Feb 5, 2020

very good to know. thanks for the explanation! for me personally this problem is solved then, i will go BsonExpressions only from now on.

because of the performance issues and the vb.net incompatiblity, i would suggest putting the [ObsoleteAttribute] onto the lambda overloads though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to listen to query param change event in react-router v5
I'd like to be able to listen to query param change events, preferably via a hook, but anything would be nice. I can't...
Read more >
Query Strings with React Router v5 - YouTube
... Strings (Solution) Query Strings Pass props to React Router v5's ... Rendering with React and React Router v5 Fixing the ' cannot...
Read more >
Query String Error
I'm getting this error which is prohibiting any events being displayed. My server is running php v7.4, mysql v5.6.x on WP 5.7.2, amr...
Read more >
A Guide to Query Strings with React Router - ui.dev
In this up-to-date guide, you'll learn what query strings are and how to use them using React Router's useSearchParams Hook.
Read more >
Getting Query Strings (Search Params) in React Router
The URLSearchParams object has a few methods that we can use to get a single value, the .get() method. If we assume this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found