Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

JSON object traversal does not work for complex objects #594

Closed
ghost opened this issue May 11, 2018 · 1 comment
Closed

JSON object traversal does not work for complex objects #594

ghost opened this issue May 11, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented May 11, 2018

I have a table with documents which have next body structure

{
    ...
    entity: {
        id: 1,
        name: 'entity'
    }
    ...
}

I want to query these documents by where in condition. So I try to call

db.table.findDoc({
    'entity.id': [1, 2, 3]
})

As result SQL query become like this

SELECT * FROM "entities" WHERE ("body" ->> 'entity') IN (1, 2, 3)

but it should be

SELECT * FROM "entities" WHERE ("body" -> 'entity' ->> 'id') IN (1, 2, 3)

Node.js: 8.11.1
Massive: 4.7.2

@dmfay
Copy link
Owner

dmfay commented May 12, 2018

Thanks for the reports! I didn't know if this was going to be possible at first with all the special handling document criteria already get but it seems to have worked out okay. Update to 4.8.2 next chance you get.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant