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

Allow collections to specify their own design document #38

Merged
merged 2 commits into from Apr 2, 2012

Conversation

Projects
None yet
2 participants
@radicand
Contributor

radicand commented Apr 2, 2012

Much like we can specify a view other than "byCollection", this PRQ allows a collection to specify its own design document if it differs from the default.

@janmonschke

This comment has been minimized.

Show comment
Hide comment
@janmonschke

janmonschke Apr 2, 2012

Owner

I just accepted another PRQ in the main repo, can you fetch the changes and merge them, so I can merge this one to the main repo as well?

Owner

janmonschke commented Apr 2, 2012

I just accepted another PRQ in the main repo, can you fetch the changes and merge them, so I can merge this one to the main repo as well?

@radicand

This comment has been minimized.

Show comment
Hide comment
@radicand

radicand Apr 2, 2012

Contributor

Done-- It should merge now, let me know if you need anything else.

Contributor

radicand commented Apr 2, 2012

Done-- It should merge now, let me know if you need anything else.

@janmonschke

This comment has been minimized.

Show comment
Hide comment
@janmonschke

janmonschke Apr 2, 2012

Owner

Awesome thx :)
If you like you can write a little text about that feature so I can put in in the documentation under 'recipes' at http://janmonschke.com/projects/backbone-couchdb.html

Owner

janmonschke commented Apr 2, 2012

Awesome thx :)
If you like you can write a little text about that feature so I can put in in the documentation under 'recipes' at http://janmonschke.com/projects/backbone-couchdb.html

janmonschke added a commit that referenced this pull request Apr 2, 2012

Merge pull request #38 from radicand/master
Allow collections to specify their own design document

@janmonschke janmonschke merged commit bd0a2ea into janmonschke:master Apr 2, 2012

@radicand

This comment has been minimized.

Show comment
Hide comment
@radicand

radicand Apr 2, 2012

Contributor

Heh, it's pretty straightforward:

If you need your collection to be sourced from a different design document, you can use the db.ddoc Collection option to specify a new design document:

  Backbone.couch_connector.config.ddoc_name = "my_main_design_doc"

  var mainCollection = Backbone.Collection.extend({
    db : {
      view : "myCollection"
    }
    ....
  });

  var otherCollection = Backbone.Collection.extend({
    db : {
      view : "myCollection",
      ddoc : "my_other_design_doc"
    }
    ....
  });

This results in mainCollection sourcing from _design/my_main_design_doc/_view/myCollection and otherCollection sourcing from _design/my_other_design_doc/_view/myCollection

Contributor

radicand commented Apr 2, 2012

Heh, it's pretty straightforward:

If you need your collection to be sourced from a different design document, you can use the db.ddoc Collection option to specify a new design document:

  Backbone.couch_connector.config.ddoc_name = "my_main_design_doc"

  var mainCollection = Backbone.Collection.extend({
    db : {
      view : "myCollection"
    }
    ....
  });

  var otherCollection = Backbone.Collection.extend({
    db : {
      view : "myCollection",
      ddoc : "my_other_design_doc"
    }
    ....
  });

This results in mainCollection sourcing from _design/my_main_design_doc/_view/myCollection and otherCollection sourcing from _design/my_other_design_doc/_view/myCollection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment