[QUESTION]: findByFields with nested fieldName
See original GitHub issueHi,
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:
- Created 2 years ago
- Comments:10 (8 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Added test case and it really should be fixed this time 😄
0.5.2
Looks like ejson should support ObjectId? We could add a small test case to check that
https://docs.mongodb.com/manual/reference/mongodb-extended-json/#bson-data-types-and-associated-representations
https://www.npmjs.com/package/bson#EJSON