What exactly is a “server collection”?
I’m trying to use a mongo aggregation function inside a server method and I always get the error of:
Error: Can only call rawCollection on server collections
Can I not use rawCollection if the collection exists on the client?
This is occurring inside a local package - could that break it?
1 Like
Hi,
Apparently the correct usage is currently Assets._collection.rawCollection()
.
Maybe the Meteor team could take some of that cool $20 million and spend a thousand or so to actually nail down a public API for using mongo aggregation…
4 Likes
This also works:
Users.rawCollection().createIndex({"profile.phone": 1}, {unique: true}, (e)-> if e then console.log e)
Just wrap it inside a if (Meteor.isServer)
block