Lars Eirik
Posts: 0
Joined: Wed Jan 23, 2013 7:59 pm

Tiggzi database: How can i reference one collection from another

I have made a Tiggzi database, an in one of the collections I have made a column that is supposed to contain references to rows in another collection (i.e. it it should hold a "foreign key"). I guess that this column should be of type "Pointer", but what values should a field of this type contain? The id of the row that its pointing to, or something else?

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

Tiggzi database: How can i reference one collection from another

Hello,
You can find a lot of useful information here: http://docs.mongodb.org/manual/applic...

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Tiggzi database: How can i reference one collection from another

Just to add to what Katya said. Here is an example doing a curl command:

code
curl -X PUT
-H "X-Tiggzi-Database-Id: xxxxxxxx....."
-H "X-Tiggzi-Session-Token : xxxxxxxx....."
-H "Content-Type: application/json"
-d '{"review": {"colName":"BookReview", "_id":"xxxxx...."}}' \
https://api.tiggzi.com/rest/1/db/collections/Book/xxxxxx
/code

Pointer type data column look like this:
code
{
"colName": "someCollection",
"_id": "xxxxxxxxxxxxxxxxx......"
}
/code

Andrew5567095
Posts: 0
Joined: Wed Feb 20, 2013 5:42 am

Tiggzi database: How can i reference one collection from another

{
"id":{
"collName":"Streets",
"id":"2"
}
},
{
"id":{
"collName":"Streets",
"id":"1"
}
},

When trying to query the following pointer records for all records where "_id" = "2", how is the where clause written?

where {"id": {"_id":"2"}}

returns a successful test but the results set is empty......

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

Tiggzi database: How can i reference one collection from another

Hi Andrew,

You can create search in database using the following request:code{"id._id": "2"}/code

Return to “Issues”