Created
September 19, 2011 20:41
-
-
Save booo/1227542 to your computer and use it in GitHub Desktop.
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
| orm = require "orm" | |
| orm.connect "postgresql://postgres:testing@localhost/orm", (success, db) -> | |
| if not success then console.log db.message | |
| else | |
| Place = db.define "place", { | |
| description: | |
| type: "string" | |
| geom: | |
| type: "geom" | |
| } | |
| Place.sync() | |
| berlin = new Place { | |
| description: "Berlin" | |
| geom: "POINT(1 1)" | |
| } | |
| berlin.save (error, copy) -> | |
| if error then console.log error | |
| else | |
| console.log berlin.id | |
| fn = -> | |
| Place.find { description: "Berlin" }, (places) -> | |
| if places | |
| console.log places | |
| #db._db._client.end() | |
| db.end() | |
| else console.log "No place with description Berlin" | |
| setTimeout fn, 10 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment