Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Populate more interests.

  • Loading branch information...
commit ecf4be1abaeab927d37cadd765c7b9e4b6b5d221 1 parent 5a7d28d
Calum Halcrow calumhalcrow authored
Showing with 13 additions and 13 deletions.
  1. +13 −13 populate.js
26 populate.js
View
@@ -10,21 +10,21 @@ var reportError = function(error) {
}
};
-Person.remove({});
-Interest.remove({});
-
var interests = ['HTML','CSS','JavaScript','Python','Perl','Haskell','Erlang'];
for (var i in interests) {
(new Interest({name: interests[i]})).save(reportError);
}
-var person = new Person();
-person.id = 'abc123';
-person.displayName = 'Calum Halcrow';
-person.name = {
- familyName : 'Halcrow'
- , givenName : 'Calum'
- , middleName : 'John'
-}
-person.interests = (Interest.findOne({name: 'HTML'})._id);
-person.save(reportError);
+Interest.findOne({name: 'HTML'}, function(error, interest) {
+ var person = new Person({
+ id : 'abc123'
+ , displayName : 'Calum Halcrow'
+ , name : {
+ familyName : 'Halcrow'
+ , givenName : 'Calum'
+ , middleName : 'John'
+ }
+ , interests : [interest._id]
+ });
+ person.save(reportError);
+});
Please sign in to comment.
Something went wrong with that request. Please try again.