Page 1 of 1

How to access a field of a database entry using the _id

Posted: Thu Jun 04, 2015 12:35 am
by Patrick Nanry

I have an array of entry _id's and would like to access a specific field of each corresponding database entry, and add it to a list. How do i go about reading a field of a database entry using the entry _id?


How to access a field of a database entry using the _id

Posted: Thu Jun 04, 2015 8:28 am
by Alena Prykhodko

Hello Patrick,

You should use pointer type for such purpose https://devcenter.appery.io/documenta...


How to access a field of a database entry using the _id

Posted: Thu Jun 04, 2015 5:57 pm
by Patrick Nanry

Does this work with a pointer to a collection in a different database?


How to access a field of a database entry using the _id

Posted: Fri Jun 05, 2015 3:39 am
by Yurii Orishchuk

Hi Patrick,

Sorry but your question is not fully clear for us.

If you want to get items from DB by it's "_id's" you have two ways to do it:

First(it's recomended to use this way) is "$in" clause:

See details here:
https://devcenter.appery.io/documenta...

Second is "$or" clause:

see details here:
http://devcenter.appery.io/documentat...

Note: you should use one of suggested clauses in the "where" clause.

For example:

1 first way.

pre

//You should replace "20" and "80" values with your stored in your array you have mentioned.
where={"Message_Creater_Id": {"$in": [20,80]}}

/pre

2 second way.

pre

//You should replace "20" and "80" values with your stored in your array you have mentioned.
where={"$or": [{"Message_Creater_Id": "20"},{"Message_Creater_Id": "80"}]}

/pre

Regards.