jCard Format
Contacts are stored within Bongo as individual documents, one contact per document. Relevant attributes for searching are brought out of the document as attributes for searching.
jCard is a JSON format based roughly on vCard aka RFC 2426. The same attributes are used, albeit with more friendly names, and where-ever possible the data is decently structured. We're also following the work on the update RFCs as they are published.
Oddly, although RFC 2426 requires that FN, N and VERSION attributes MUST be present, they're not in the examples. However, for our purposes, we will specify that the must be present.
The version attribute will attempt to follow vCard. However, we will adjust as necessary to ensure forward compatibility: jCard 3.0 apps must be able to deal with jCard 3.1+ formats without breakage, although they may reject 4.0+.
In order to achieve that, we may only extend the JSON structure in certain ways.
Empty example
A very basic JCard as stored:
{"jCard":3,"fullName":"Test contact",
"name":{"familyName":[],"givenName":[],"additionalNames":[],
"prefix":[],"suffix":[]},"email":[{"address":"test@example.com",
"type":["internet"]}]}
Example representation
The RFC for vCard gives the following contact for an author:
BEGIN:vCard VERSION:3.0 FN:Frank Dawson ORG:Lotus Development Corporation ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive ;Raleigh;NC;27613-3502;U.S.A. TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515 TEL;TYPE=FAX,WORK:+1-919-676-9564 EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com EMAIL;TYPE=INTERNET:fdawson@earthlink.net URL:http://home.earthlink.net/~fdawson END:vCard
This is expressed in jCard as:
{
'jCard': 3.0,
'fullName' : 'Frank Dawson',
'organisation' : 'Lotus Development Corporation',
'addresses' : [
{
'type' : ['work', 'postal', 'parcel'],
'pobox' : '', 'extended' : '',
'street' : '6544 Battleford Drive',
'locality' : 'Raleigh',
'region' : 'NC',
'postcode' : '27613-3502',
'country' : 'U.S.A'
}
],
'telecoms' : [
{
'type' : ['voice', 'msg', 'work'],
'number' : '+1-919-676-9515'
},
{
'type' : ['fax', 'work'],
'number' : ':+1-919-676-9564'
}
],
'email' : [
{
'type' : ['internet', 'preferred'],
'address' : 'Frank_Dawson@Lotus.com'
},
{
'type' : ['internet'],
'address' : 'fdawson@earthlink.net'
}
],
'url' : [
{
'type' : ['personal'],
'href' : 'http://home.earthlink.net/~fdawson'
}
]
}
Clearly this is a fair bit more verbose - mostly due to breaking out the address into a named structure rather than relying on position in array - but is more straightforward to use and parse.
