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.

Nested matching appears to be broken

See original GitHub issue

I just wanted to start by saying thanks again for a great lib!

I’ve been trying to upgrade the sift dependency for mson from version sift 9.0.0. Unfortunately, I’m seeing a number of issues. I dug into a particular problem and am seeing an issue with matching nested queries, e.g. the following filter doesn’t capture any values with sift v13.1.10. It does however work with sift v9.0.0:

import sift from "sift";

const where = {
  fields: {
    firstName: {
      value: {
        $eq: "Jimmy"
      }
    }
  }
};

const whereProps = {
  fields: {
    firstName: {
      value: "Jimmy"
    }
  }
};

const sifted = [whereProps].filter(sift(where));
console.log({ sifted });

Here’s a codesandbox for it not working in v13.1.10. And one for it working in v9.0.0

I haven’t had a chance yet to identify a root cause yet.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
redgeoffcommented, Jul 19, 2020

OK, I think I follow now. Here you can see that the nesting does not work, but the dot notation does work.

For GitHub, here are the details of the mongoplayground that illustrates that nested searching doesn’t work in MongoDB:

Configuration:

[
  {
    fields: {
      firstName: {
        value: "Jimmy"
      }
    }
  }
]

Query:

db.collection.find({
  fields: {
    firstName: {
      value: {
        $eq: "Jimmy"
      }
    }
  }
})

=> The Query doesn’t return any results

Thanks for the help!

0reactions
crcncommented, Jul 19, 2020

Sorry for the confusion here – MongoDB in this case is treating $eq has a prop. Here’s a better example: https://mongoplayground.net/p/0UIcUQl8Z3v

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested Yara matching doesn't work - yr_scanner seems to be ...
New scanner API in libyara (>=3.8.0) generates "segmentation fault" when additional scanning is executed from the callback.
Read more >
Nested vs flattened pattern match in Scala - Stack Overflow
While the nested version avoids duplicate typing, it can lead to hard-to-read code due to indentation overflow when n is high (and we...
Read more >
My filter suggestions are broken for nested data in Big Query ...
The recommended strategy for handling nested fields in BigQuery is to create separate views for the nested fields and join them to the...
Read more >
Broken links when using nested shared components from ...
Hi! I created this very complex workflow that includes many nested shared components. I am a big fan of relative paths for that...
Read more >
How to correct a #N/A error in INDEX/MATCH functions
SOLUTION: To remove unexpected characters or hidden spaces, use the CLEAN or TRIM function, respectively. Also, verify if the cells are formatted as...
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