Closed vladejs closed 8 years ago
Actually, i think transformDoc
can be used only clientside, so its not a solution to my problem.
Any idea of how to return other collection along to the one iam searching on? (reference models)
I answer myself. You can return everything you need on the client within the metadata
property, like so:
SearchSource.defineSource('posts', function(searchText, options) {
// ...
return {
data : Collection.find(selector,options).fetch(),
metadata: {
images : Files.files.find().fetch()
imagesCount : Files.files.find().count()
collectionCount : Collection.find(selector,options).count()
}
}
});
Maybe this is a dumb question, but i saw in the examples there is a
transformDoc
property which can be used to modify the docs.Is there a way to skip this and return a publish function instead?
I have a Collection named
post
which has apostThumbnail
property, which is a reference to a document inFiles.files
collection. I return every post thumbnail usingpublishComposite
publication on server, so it will be awesome if instead of returning a cursor, i could specify a named publication, something like:I know problem can be solved using
transformDoc
but who knows, maybe this is possible.