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

How to get collection from a string "name" #2

Open
raix opened this issue Nov 18, 2014 · 6 comments
Open

How to get collection from a string "name" #2

raix opened this issue Nov 18, 2014 · 6 comments

Comments

@raix
Copy link
Contributor

raix commented Nov 18, 2014

I often find my self in having to wrap the Meteor.Collection in order to get a lookup option. I may have the collection name but currently there isnt a way to resolve the string into a collection?

Eg.

  // Client + Server
  var myTestCollection = Mongo.Collections.lookup('test');
@dandv
Copy link
Member

dandv commented Nov 18, 2014

autocomplete uses golbal[collectionName]

There's also this SO question - http://stackoverflow.com/questions/10984030/get-meteor-collection-by-name

@awatson1978
Copy link

I've been preparing to do an extended collections API, because of the getTimestamp() issues; as well as exposing db.stats() and db.serverStatus(). I'd be more than happy to add .lookup(). Although ETA is probably 3 months off still.

https://github.com/awatson1978/collection-extended-api/blob/master/README.md

@mitar
Copy link

mitar commented Dec 18, 2014

I have some extensions to the API in directcollection package. One thing I am missing (from Django) is .exists() query, which would make an optimized query and tell you if the query matches any document. Doing .count() instead is very bad because you do not really need/want precise number (and counting a precise number is not very cheap in MongoDB).

@mitar
Copy link

mitar commented Dec 18, 2014

Related: meteor/meteor#1504

@dandv
Copy link
Member

dandv commented Dec 19, 2014

In the meantime I've used in rubaxa:sortable and improved @dburles' mongo-collection-instances

@mitar
Copy link

mitar commented Jan 26, 2016

I think this pull request which was recently merged could help a bit: meteor/meteor#5845

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

No branches or pull requests

4 participants