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

Are filters/views engine specific? #138

Open
sakkaku opened this issue Feb 13, 2013 · 1 comment
Open

Are filters/views engine specific? #138

sakkaku opened this issue Feb 13, 2013 · 1 comment

Comments

@sakkaku
Copy link

sakkaku commented Feb 13, 2013

When I try to boot up my app with the memory store after running fine in couchdb it gives:

/Users/sakkaku/Dropbox/Projects/SecondLife/express/node_modules/resourceful/lib/resourceful/engines/memory.js:128
callback(null, result);
^
TypeError: object is not a function
    at Memory.filter (/Users/sakkaku/Dropbox/Projects/SecondLife/express/node_modules/resourceful/lib/resourceful/engines/memory.js:128:5)
    at Memory.request (/Users/sakkaku/Dropbox/Projects/SecondLife/express/node_modules/resourceful/lib/resourceful/engines/memory.js:59:8)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Of course that is the Memory.prototype.filter function. This fails at the declaration stage and not while executing the filter.

Example filter I have that breaks:

User = resourceful.define 'user', ->
    @string 'name'

    @filter 'getByName', (name) ->
        return name: name

Is there a way to write filters that work in both environments? I found zero documentation on filters so any help would be appreciated.

Also you might want to add documentation on how to add auth to couchdb, I had to scour the source for a few minutes to solve that mystery. This is the method that looked the most 'correct'.

resourceful.use 'couchdb',
    uri: 'http://example.com/'
    auth:
        username: 'user'
        password: 'pass'
@ssevertson
Copy link
Contributor

I created a PR which implements CouchDB-compatible filtering for the Memory engine: #143

If you need this functionality before the PR is accepted, feel free to use my fork: https://github.com/ssevertson/resourceful - the master branch contains both PR 143, and PR 142 (which resolves view name conflicts in CouchDB design documents). To use, add the following to your package.json:

"resourceful": "git://github.com/ssevertson/resourceful.git#master"

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