Last active
July 17, 2016 07:30
-
-
Save NSLog0/e51796961acaf0bb11fe8ddc1ade82c5 to your computer and use it in GitHub Desktop.
for my tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
name: "Algorithmtut", | |
url: "www.algorithmtut.com", | |
page_like: 1467 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
name: "Algorithmtut", | |
detail: { | |
url: "www.algorithmtut.com", | |
page_like: 1467 | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// site_collection | |
{ | |
_id: 12, | |
name: "Algorithmtut", | |
url: "www.algorithmtut.com", | |
page_like: 1467 | |
} | |
//owner_site_collection | |
{ | |
_id: 1, | |
name: "John Doe", | |
website: ObjectID('12') // site_collection ID | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Define: use can have many site | |
// user | |
{ | |
_id: 1, | |
name: "John Doe", | |
} | |
// site | |
{ | |
_id: 12, | |
name: "Algorithmtut", | |
url: "www.algorithmtut.com", | |
page_like: 1467, | |
user_id : ObjectID('1') | |
} | |
{ | |
_id: 33, | |
name: "Google", | |
url: "www.google.com", | |
page_like: 1467, | |
user_id: ObjectID('1') | |
} | |
{ | |
_id: 43, | |
name: "Simple", | |
url: "www.simple.com", | |
page_like: 1467, | |
user_id: ObjectID('1') | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Define: use can have many site | |
// user | |
{ | |
_id: 1, | |
name: "John Doe", | |
website: [ | |
{ | |
name: "Algorithmtut", | |
url: "www.algorithmtut.com", | |
page_like: 1467, | |
}, { | |
name: "Google", | |
url: "www.google.com", | |
page_like: 1467, | |
} | |
] | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Define: use can have many site | |
// user | |
{ | |
_id: 1, | |
name: "John Doe", | |
website: [ | |
ObjectID('12'), | |
ObjectID('33'), | |
ObjectID('43') | |
] | |
} | |
// site | |
{ | |
_id: 12, | |
name: "Algorithmtut", | |
url: "www.algorithmtut.com", | |
page_like: 1467, | |
} | |
{ | |
_id: 33, | |
name: "Google", | |
url: "www.google.com", | |
page_like: 1467, | |
} | |
{ | |
_id: 43, | |
name: "Simple", | |
url: "www.simple.com", | |
page_like: 1467, | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table `users` ( | |
`id` int unsigned not null auto_increment, | |
`name` varchar(100) not null, | |
primary key(`id`) | |
); | |
create table `phone_numbers` ( | |
`id` int unsigned not null auto_increment, | |
`user_id` int unsigned not null, | |
`phone_number` varchar(25) not null, | |
index pn_user_index(`user_id`), | |
foreign key (`user_id`) references users(`id`) on delete cascade, | |
primary key(`id`) | |
); | |
// simple data in users | |
{ | id: 1 | name: 'John Doe' | } | |
// simple data in phone_numbers | |
{ | id: 1 | user_id: 1 | } | |
{ | id: 2 | user_id: 1 | } | |
{ | id: 3 | user_id: 1 | } | |
{ | id: 4 | user_id: 1 | } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment