Helsen
Posts: 0
Joined: Wed Jul 31, 2013 1:42 pm

questions about query with pointer fields

Hi Appery.io team
I have 3 collections

company
field: _id
field: _name

category
field: _id
field: _name

company_category
field: _id
field: id_company (pointer field to company)
field: id_category (pointer field to category)

I have a query Service to COMPANY_CATEGORY that show all data in COMPANY and CATEGORY collections.

But I need data from specific category (where category._name = 'food').

I don ́t know what I need write in JAVASCRIPT of WHERE in this service. Please help me

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

questions about query with pointer fields

Hi Helsen,

You should add request parameter "where" and pass there something like thispre{"id_category": {"$in": arr}}/preWhere 'arr' is a variable containing an array of categories id. This array can be obtained from another service, which will get the data from the collection 'category'. Here parameter 'where' is added with the value pre {"_name":"food"}/pre

Helsen
Posts: 0
Joined: Wed Jul 31, 2013 1:42 pm

questions about query with pointer fields

Thanks for reply Katya,

I know how to use the query with where and "$in", sorry for my bad english.

My problem is how to use query with where, when use values obtained from pointers fields.

Helsen
Posts: 0
Joined: Wed Jul 31, 2013 1:42 pm

questions about query with pointer fields

To be more specific, can you explain your doc (Queries on Pointer Values):

http://docs.appery.io/documentation/b...

with my Collection schema?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

questions about query with pointer fields

Hello! Sorry for delay. We have noSql DB and there are no such requests to collection. For "company_category" collection you can retrieve all records from "category" collection and using JS select what you need. To retrieve all records use "include" in request.

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

questions about query with pointer fields

This can be very inefficient, especially if the dataset is large. There has to be another away to get the desired dataset more efficiently.

Are you sure there is no other way ?

Return to “Issues”