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.

v3.0.0 - Latest - Bug with Query.LT() and Query.LTE()

See original GitHub issue

Find call with Query.LT() and Query.LTE() are not working for me (whereas GT and GTE work fine).

Here’s what I’m doing:

I create a collection and insert 3 documents with _id values: 10, 20, 30

I call:

return _liteCollection.FindOne(Query.LTE("_id", 22));

However, it returns document with ID of 10 (not 20).

The same problem occurs with Find() as well as FindOne().

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kuiperzonecommented, Jan 1, 2017
> db.col1.find ({_id:{$lt:22}})
{ "_id" : 10 }
{ "_id" : 20 }

Ahh! I understand now. I see the use of LT/E, although it’s not what I expected. Sorry, I’m not familiar with MongoDB – LiteDB is my introduction to NoSQL.

Thank you for looking into it!

0reactions
mbdavidcommented, Jan 1, 2017

Here some tests made with mongodb

> db.col1.insert ({"_id":10})
WriteResult({ "nInserted" : 1 })
> db.col1.insert ({"_id":20})
WriteResult({ "nInserted" : 1 })
> db.col1.insert ({"_id":30})
WriteResult({ "nInserted" : 1 })
> db.col1.find ({_id:{$lt:22}})
{ "_id" : 10 }
{ "_id" : 20 }
> db.col1.findOne ({_id:{$lt:22}})
{ "_id" : 10 }
> db.col1.find ({_id:{$lt:22}}).sort({_id:-1})
{ "_id" : 20 }
{ "_id" : 10 }

Mongo use same logic, but has sort options. In LiteDB you must use OrderBy LINQ.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongodb has a bug on "$lte" (query or aggregation) while ...
I've tested it on aggregation $match pipelines and find queries on: my codebase; a clean script that just does this operations; directly on ......
Read more >
Problem with query using $lt - Working with Data
I want to query a Date field. The query should return all the records that are between 2 dates. When I use the...
Read more >
Having problems with query using where on fields of type ...
Newbie to Prisma 2. SQLite3 database. Prisma Model of table in question. Model wad generated via introspection of the db. model EPG_EVENT {...
Read more >
Mongoose v7.4.3: Query
Query constructor used for building queries. You do not need to instantiate a Query directly. Instead use Model functions like Model.find() .
Read more >
4. Querying - MongoDB: The Definitive Guide, 2nd Edition ...
You can query for ranges, set inclusion, inequalities, and more by using $ -conditionals. Queries return a database cursor, which lazily returns batches...
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