Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@spf13
Created February 3, 2012 18:13
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save spf13/1731468 to your computer and use it in GitHub Desktop.
Save spf13/1731468 to your computer and use it in GitHub Desktop.
Genealogy Schema for MongoDB
individual = {
_id : ObjectId("4f2978dfaa999d9db02618ce"),
AFN : '1XYK-KQJ',
name: {
first: ['john', 'johannes'],
middle: 'peter',
last: ['smith', 'sandvik']
},
events : [
birth : [
{
date : ISODate('1928-04-06'),
location : {
city: 'brattleboro',
state: 'vt',
county: 'windham',
country: 'usa'
coordinates : [42.51,72.34]
},
contributor : ObjectId("4eeabc958b691537bb000000"),
records: ObjectId("4ed8aea7d8562f7d7b000000")
},
{
date : ISODate('1928-04-16'),
location : {
city: 'brattleboro',
state: 'vt',
county: 'windham',
country: 'usa'
coordinates : [42.51,72.34]
},
contributor : ObjectId("4eeabc958b691537bb000000"),
records: ObjectId("4eeabc9a8b691537bb0000c8"),
},
],
death : {
date : ISODate('1989-07-14'),
location : {
city: 'pensacola',
state: 'fl',
county: 'escambia',
country: 'usa'
coordinates : [30.26,87.12]
},
contributor : ObjectId("4eeabc958b691537bb000000"),
},
marriage : [
{
date : ISODate('1939-08-11'),
end_date : ISODate('1940-02-19'),
to : ObjectId("4f297978aa999d9db02618cf"),
location : {
city: 'raleigh',
state: 'nc',
county: 'wake',
country: 'usa'
coordinates : [35.49,78.38]
},
contributor : ObjectId("4eeabc958b691537bb000000"),
},
{
date : ISODate('1944-04-19'),
to : ObjectId("4f2978dfaa999d9db02618ce"),
location : {
city: 'atlanta',
state: 'ga',
county: 'fulton',
country: 'usa'
coordinates : [33.45,84.23]
},
contributor : ObjectId("4eeabc958b691537bb000000"),
},
]
]
}
record1 = {
_id : ObjectId("4ed8aea7d8562f7d7b000000")
contributor : ObjectId("4eeabc958b691537bb000000"),
type : 'birth certificate',
thumbnail : BinData(0,"/9j/4AAQSkZJRgABAQEASABIAA...."),
content : BinData(0,"j6b/Id11l4ePpojBUeoI/JcsX0...."),
tags : [ 'NY', 'certified'],
description : "Uncle John's birth certificate"
}
record2 = {
_id : ObjectId("4eeabc9a8b691537bb0000c8"),
contributor : ObjectId("4eeabc958b691537bb000000"),
type : 'baptism certificate',
thumbnail : BinData(0,"unou9jh091XmsJD4fbKJ/wCHOz5...."),
content : BinData(0,"cWv208WxqGvZkqaKjc5h881O3lSn4ghp..."),
tags : [ 'NY', 'catholic']
}
user = {
_id : ObjectId("4eeabc958b691537bb000000"),
username : 'spf13',
email_address : 'genealogy.master@spf13.com',
password : 'a.long.passphrase18',
individual_id : ObjectId("4f2978dfaa999d9db02618ce"),
}
db.individual.save(individual);
db.individual.find({events.birth.date : MongoDate('April 6, 1928')});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment