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.

[QUESTION]: findByFields with nested fieldName

See original GitHub issue

Hi,

I am trying to query my DB using findByFields.

I am doing the following:

this.findByFields({ "contacts._id": _id });

My DB structure looks like this:

[
  {
    contacts: [
      {
        _id: "some id"
      },
      {
        _id: "some id 2"
      }
    ]
  },
  {
    contacts: [
      {
        _id: "some id 3"
      },
      {
        _id: "some id 4"
      }
    ]
  }
]

I was assuming by searching using field “contacts._id” would work but it doesn’t seem to work. When I ouput what loader returns for filter I get:

{ 'contacts._id': { '$in': [ '603ce3183499636b66d6d102' ] } }

It seems to transform my value to a string instead of keeping it as an object id.

Not sure if I am doing something wrong?

Any help is appreciated, thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
lorensrcommented, Sep 4, 2021

Added test case and it really should be fixed this time 😄 0.5.2

1reaction
lorensrcommented, Sep 3, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

spring data - Mongodb - findBy Method for nested objects
My problem is when I execute this method with userId as 1 and questionID as 3, it returns the entire questions list irrespective...
Read more >
readField not working on nested data - Help - Apollo GraphQL
Using GitHub's GraphQL API, I'm trying to figure out the “right” way to sort my respositories by the number of open PRs: Here's...
Read more >
V3 InMemoryCache: Object Fieldname Characters too ...
I have a nested object that uses Guids as the fieldname: var user = { id: '1', ... This may point to a...
Read more >
Spring Data Couchbase - Reference Documentation
The value resolution assumes constructor/factory method argument names to match the property names of the entity, i.e. the resolution will be performed as...
Read more >
Finding an item in a nested object of objects - MongoDB
Hi, so I have the following query set up (with data): query test { character(charID="a", enemy:"c") { charID enemy { name weapons {...
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