Permalink
Browse files

Updates postgres example

Still very simple, but will be updated in the future, similar to mysql
  • Loading branch information...
1 parent 2197ccb commit ed1c833d7ac255cb74abc7e07919b4c3c49eaa33 @dresende committed Jun 20, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 examples/postgres.js
View
@@ -1,6 +1,6 @@
var orm = require(__dirname + "/../lib/orm");
-orm.connect("pg://postgres:postgres@localhost/amber", function (success, db) {
+orm.connect("pg://orm:orm@localhost/orm", function (success, db) {
if (!success) {
console.log("Error %d: %s", db.number, db.message);
return;
@@ -12,6 +12,12 @@ orm.connect("pg://postgres:postgres@localhost/amber", function (success, db) {
Person.sync();
Person.find({ name: [ "John Doe" ] }, function (people) {
- console.log(people);
+ if (people !== null) {
+ return console.log(people);
+ }
+ var John = new Person({ "name": "John Doe", "created": new Date() });
+ John.save(function (err, person) {
+ console.log(person);
+ });
});
});

0 comments on commit ed1c833

Please sign in to comment.