Patrick Nanry
Posts: 0
Joined: Sat May 30, 2015 1:50 am

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

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?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

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

Hello Patrick,

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

Patrick Nanry
Posts: 0
Joined: Sat May 30, 2015 1:50 am

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

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

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.

Return to “Issues”