Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Don't expose collections directly #32

Closed
stubailo opened this issue Nov 6, 2015 · 8 comments
Closed

Don't expose collections directly #32

stubailo opened this issue Nov 6, 2015 · 8 comments

Comments

@stubailo
Copy link
Contributor

stubailo commented Nov 6, 2015

Collections - don't expose the collection directly, have an API for talking to it in case you need to change the schema or guarantees later

@stubailo
Copy link
Contributor Author

stubailo commented Nov 6, 2015

@tmeasday do you think this is a good idea? This is in the "building a package" outline.

@tmeasday
Copy link
Contributor

tmeasday commented Nov 7, 2015

I'm not quite sure what this means in practice. You mean that we wouldn't have a exported symbol called Todos? How would you do queries?

@stubailo
Copy link
Contributor Author

stubailo commented Nov 9, 2015

Well the idea is, you would have methods on Todos like: Todos.getInList(listId) instead of Todos.find({ listId: listId })

This way you could switch to another DB more easily? Not sure how realistic it is.

@tmeasday
Copy link
Contributor

My sense is it's too much of a departure from how people typically do things at this point in time.

@stubailo
Copy link
Contributor Author

OK sounds good. It's just something we ran into twice:

  1. When converting Todos to use SQL
  2. When we wanted to change how Accounts worked internally, it was tough that we exposed Meteor.users as an API

@tmeasday
Copy link
Contributor

I think it makes a heap of sense for point 2., but gets to the larger discussion of saying users shouldn't use the users collection...

@stubailo
Copy link
Contributor Author

Yeah but the point still stands that it's too different from what people do now.

@tmeasday
Copy link
Contributor

Yep, put it on the ideas list for guide v2 :)

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

No branches or pull requests

2 participants