Questions tagged [meteor-collections]

Collections are Meteor's way of storing persistent data

From the official documentation :

Collections are Meteor's way of storing persistent data. The special thing about collections in Meteor is that they can be accessed from both the server and the client, making it easy to write view logic without having to write a lot of server code. They also update themselves automatically, so a view component backed by a collection will automatically display the most up-to-date data.

Creating a new collection is as easy as calling MyCollection = new Mongo.Collection("my-collection"); in your JavaScript. On the server, this sets up a MongoDB collection called my-collection; on the client, this creates a cache connected to the server collection. We'll learn more about the client/server divide in step 12, but for now we can write our code with the assumption that the entire database is present on the client.

81 questions
3
votes
1 answer

meteor.js & spacebars - passing variables in nested loop

Context I’m trying to use Handlebars to loop through events and then nested loop through images. I need to select only the images that correspond to the event that the event loop is currently on. Problem I can’t pass the _id of the event inside the…
Sekoul
  • 1,361
  • 2
  • 14
  • 30
3
votes
3 answers

Meteor collections: how to connect to different collections referring to each other?

I have two collections: Contracts = new Mongo.Collection('contracts'); Reminders = new Mongo.Collection('reminders'); These are structured in the database more or less like this: Contracts: { "id": "4432234", "contract": "C-42432432", …
mHauken
  • 33
  • 2
3
votes
1 answer

Publication of items where User is in group (Alanning Roles and Publications)

I am using Alanning Roles to maintain a set of groups/roles for the users of my application. When a user creates an "Application", I generate a new role for them as the app_name + UUID, then add that as a group with the roles of Admin to the user…
CodeChimp
  • 8,016
  • 5
  • 41
  • 79
2
votes
1 answer

Meteor js custom pagination

I kindly need a support. I have written a pagination following a YouTube tutorial, which works fine with the exception of when going backwards again. It has only 2 buttons, previous and next, when the next button is clicked it works fine but the…
ken4ward
  • 2,246
  • 5
  • 49
  • 89
2
votes
3 answers

Meteor Publish-Composite nesting issue

Problem: I have a number of groups that each have members that belong to different groups. Each member has a title (role) in each group. I’m trying to list all the groups and display each member in the group and their title. I’m using…
Bob Lorriman
  • 359
  • 1
  • 3
  • 10
2
votes
1 answer

meteor.js & mongoDB - query with multiple fields

CONTEXT I am trying to create a search functionality allowing users to fill in multiple fields, submit, and see a list of matching items from one collection. I do this using a form on the front end, which updates session variables on back-end, which…
Sekoul
  • 1,361
  • 2
  • 14
  • 30
2
votes
0 answers

meteorjs (CollectionFS) read the files source

I am using CollectionFS for my meteorjs Application and trying to upload a file and then read the source to do other stuff. The holw list I want to do is the following: Upload the file Read out the source Depends on the content I will delete or…
TJR
  • 6,307
  • 10
  • 38
  • 64
2
votes
2 answers

Is it possible to define multiple template helpers en masse instead of one-by-one in Meteor?

Collection with name Services has multiple documents: { serviceTitle: "Unlimited HDR Photography", serviceDescription: "Includes unlimited daytime HDR photos and a single trip out to the property. A zip file with the bare JPG files will be…
1
vote
0 answers

Find latest record for based on multiple ID's using Meteor

I have a collection in mongodb which has the following format: { parentId: "12345akNu", createdAt: "2018-12-02", complete: false } I would like to find all most recent records for a set of parentId's which are not completed. I currently…
Hans
  • 2,800
  • 3
  • 28
  • 40
1
vote
1 answer

Server side timer after meteor collection is updated

I'm currently developping a simple realtime multiplayer game and i'm stuck with the timer logic. When there are enough players in a game, the status of the game is set to "STARTED" and from there i want to start a 10 seconds timer and show it to all…
1
vote
1 answer

Inserting External, Reactive API Data into a Meteor Collection

I have some external data I'm calling from an API. The data is WordPress posts objects I'm fetching via the WordPress API. I'm using the HTTP package and my code looks like this. server.js const articleIncoming = HTTP.call( 'GET',…
Shingai Munyuki
  • 551
  • 1
  • 11
  • 25
1
vote
2 answers

Meteor: Speeding up MongoDB Join's for Big Data?

I have two collections: Data and Users. In the Data collection, there is an array of user IDs consisting of approximately 300 to 800 users. I need to join together the countries of all of the users for each row in the Data collection, which hangs my…
Dranithix
  • 378
  • 3
  • 12
1
vote
1 answer

How to get userId in observe callback

I want to use observe for one of my collection on the server but I need to get userId, I'm trying to use this.userId and also Meteor.userId() but not working! see the below code for more detail and error message how to resolve it…
1
vote
1 answer

Why is the reactivity of a local collection messing up my UI?

I have this in the parent template: {{#each oddsReactive in bet.oddsChecked}} {{>InputOdds arrayKey='oddsChecked' arrayIndex=@index}} {{/each}} The helper "bet" provides this data: bet: () => ChecksCollection.findOne() where: ChecksCollection =…
1
vote
2 answers

Meteor find is returning null with variable

Description of the problem: I have two collections videos and specs. videos collection has a key called spec which corresponds to a specs id. Both collections are not empty. My Template Helper: Template.List.helpers({ videos: function(){ …
kemicofa ghost
  • 16,349
  • 8
  • 82
  • 131
1
2 3 4 5 6