Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres .find doesn't work #55

Closed
fiestacasey opened this issue Apr 2, 2012 · 2 comments
Closed

Postgres .find doesn't work #55

fiestacasey opened this issue Apr 2, 2012 · 2 comments

Comments

@fiestacasey
Copy link

Using any of my models, I can use findOne but not find.

Example:

#define
User = pg_db.define('User', {
    name: { type: String, length: 255 }
    username: { type: String, length: 255 }
    token:  { type: String, length: 255 }
    email:  { type: String, length: 255 }
  }, {table: 'users'})


User.find {where: {name: 'name'}},(err,users)->
  if err?
    console.log err

Gives me:

{ [error: syntax error at or near "["]
  length: 83,
  name: 'error',
  severity: 'ERROR',
  code: '42601',
  detail: undefined,
  hint: undefined,
  position: '46',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  file: 'scan.l',
  line: '1001',
  routine: 'scanner_yyerror' }
@1602
Copy link
Owner

1602 commented Apr 2, 2012

Model.find is for searching by id, Model.all - for querying collection,
Model.findOne - querying single record. Check api docs for abstract-class
at makedoc.node-js.ru

On Tue, Apr 3, 2012 at 1:15 AM, kcsobo <
reply@reply.github.com

wrote:

Using any of my models, I can use findOne but not find.

Example:

#define
User = pg_db.define('User', {
name: { type: String, length: 255 }
username: { type: String, length: 255 }
token: { type: String, length: 255 }
email: { type: String, length: 255 }
}, {table: 'users'})

User.find {where: {name: 'name'}},(err,users)->
if err?
console.log err

Gives me:

{ [error: syntax error at or near "["]
length: 83,
name: 'error',
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '46',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
file: 'scan.l',
line: '1001',
routine: 'scanner_yyerror' }


Reply to this email directly or view it on GitHub:
#55

Thanks,
Anatoliy Chakkaev

@fiestacasey
Copy link
Author

awesome. thank you for pointing me in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants