# PostgreSQL $in query not working in aggrigation pipeline

**URL:** <https://community.parseplatform.org/t/postgresql-in-query-not-working-in-aggrigation-pipeline/2579>\
**Category:** Cloud Code\
**Tags:** query, postgres\
**Created:** [April 7, 2022, 2:56pm UTC](https://community.parseplatform.org/t/postgresql-in-query-not-working-in-aggrigation-pipeline/2579 "2022-04-07T14:56:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeevan-ghule](https://community.parseplatform.org/user_avatar/community.parseplatform.org/jeevan-ghule/32/1113_2.png) [@jeevan-ghule](https://community.parseplatform.org/u/jeevan-ghule)\
**Post date:** [April 7, 2022, 2:56pm UTC](https://community.parseplatform.org/t/postgresql-in-query-not-working-in-aggrigation-pipeline/2579/1 "2022-04-07T14:56:10Z")

</div>

Hi, I am using PostgreSQL as a database.  
When I am finding data for the country which belongs to given countries list

[{"$match":{“isMetadataSync”:true,“country”:{"$in":[“india”]},“isListed”:true}},{"$skip":0},{"$limit":50},{"$project":{“name”:1,“genre”:1,“description”:1,“price”:1,“tokenId”:1,“itemId”:1,“country”:1,“category”:1,“likesCount”:1,“imageHttps”:1,“coverHttps”:1,“isListed”:1,“owner”:1,“creator”:1}}]

But this is not working for PostgreSQL (working for Mongo)

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [April 8, 2022, 3:14pm UTC](https://community.parseplatform.org/t/postgresql-in-query-not-working-in-aggrigation-pipeline/2579/2 "2022-04-08T15:14:14Z")

</div>

Can you share the query that you are doing on Postgres? Any error message?

---

<div class="post-metadata">

**Author:** ![jeevan-ghule](https://community.parseplatform.org/user_avatar/community.parseplatform.org/jeevan-ghule/32/1113_2.png) [@jeevan-ghule](https://community.parseplatform.org/u/jeevan-ghule)\
**Post date:** [April 8, 2022, 6:49pm UTC](https://community.parseplatform.org/t/postgresql-in-query-not-working-in-aggrigation-pipeline/2579/3 "2022-04-08T18:49:36Z")

</div>

The query is executed not giving any error but not given find result for $in  
Above mention, the pipeline is used in aggregation.  
I have debug the code and found that in postgresStorageAdapter not transforming into SOL query for $in

But I have found the way through query.find() rather than query.aggrigate()  
query.containedIn(“country”, ['india]);  
working for me

Just one more piece of information needed for me on the search task  
I have to store price value in PostgreSQL in **numeric** data type, not in **double precision**  
How to store and set in schema , there is only **Number** datatype option available

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [April 11, 2022, 5:01am UTC](https://community.parseplatform.org/t/postgresql-in-query-not-working-in-aggrigation-pipeline/2579/4 "2022-04-11T05:01:37Z")

</div>

As long as I know, Postgres adapter does not support aggregate. So `containedIn` is the way to go.
