Meteor

Meteor

Meteor is a modular platform for developing web and mobile applications in JavaScript based on the NodeJS platform.
Alayna  Rippin

Alayna Rippin

1598187600

#3 Real time Data With Meteor - Full Stack Reactive Meteor and Svelte

Hello LevelUpTuts, after watching this I have followed the ToDo tutorial on meteor + svelte on meteor.com
, it works great and I have happily deployed it to heroku. I am looking for more content on meteor + svelte, I want to get some guidance on routing and restricted pages and so on, basically I want to make a full featured blog, as a hobby project. Anyone have ideas on where to look? Will this series continue some day? Thanks for all your great content! Stay safe! <3

#meteor #reactive #meteor and svelte

#3 Real time Data With Meteor - Full Stack Reactive Meteor and Svelte

Hire Dedicated Meteor Developers

Get your Web Application developed in Meteor.js!

HourlyDeveloper.io is one of the leading Meteor js development company. You can Hire Dedicated Meteor Developers who are properly trained and have all the experiences needed to utilize all the features of Meteor js and capable of building installable iOS and Android awesome and amazing apps.

Consult with our experts:- https://bit.ly/2zKSdSB

#hire dedicated meteor developers #meteordevelopmentcompany #meteordeveloper #meteordevelopmentservices #meteordeveloment #meteor

Hire Dedicated Meteor Developers
Elias  Ortiz

Elias Ortiz

1616381340

Full Stack Reactive Meteor and Svelte - Adding Svelte To Meteor

Full Stack Reactive Meteor and Svelte - Adding Svelte To Meteor

#svelte #meteor

Full Stack Reactive Meteor and Svelte - Adding Svelte To Meteor
Elias  Ortiz

Elias Ortiz

1616035740

Full Stack Reactive Meteor and Svelte - Installing Meteor and Starting Our Project

Full Stack Reactive Meteor and Svelte - Installing Meteor and Starting Our Project

#meteor #svelte

Full Stack Reactive Meteor and Svelte - Installing Meteor and Starting Our Project
Elias  Ortiz

Elias Ortiz

1616640540

Full Stack Reactive Meteor and Svelte - Real time Data With Meteor

Full Stack Reactive Meteor and Svelte - Real time Data With Meteor

#meteor #svelte

Full Stack Reactive Meteor and Svelte - Real time Data With Meteor
Elias  Ortiz

Elias Ortiz

1617504540

Full Stack Reactive Meteor and Svelte - Easy User Accounts with Svelte and Meteor

Full Stack Reactive Meteor and Svelte - Easy User Accounts with Svelte and Meteor

Svelte Accounts UI https://github.com/leveluptuts/svelte-accounts-ui
Code here: https://github.com/leveluptuts/meteor-svelte-code

#svelte #meteor

Full Stack Reactive Meteor and Svelte - Easy User Accounts with Svelte and Meteor
Elias  Ortiz

Elias Ortiz

1616986140

Full Stack Reactive Meteor and Svelte- Inserting In Real Time - Meteor and Svelte Tutorial

Full Stack Reactive Meteor and Svelte- Inserting In Real Time - Meteor and Svelte Tutorial
Code: https://github.com/leveluptuts/meteor-svelte-code

#meteor #svelte

Full Stack Reactive Meteor and Svelte- Inserting In Real Time - Meteor and Svelte Tutorial
Ethan Hughes

Ethan Hughes

1611567540

Simple Denormalization for Meteor

Denormalize

Simple denormalization for Meteor

Introduction

meteor add herteby:denormalize

In this readme, parent always refers to the documents in which the cache is stored, while child refers to the documents that will be cached.

Example: You have two collections - Users and Roles. The Users store the _id of any Roles they have been assigned. If you want each User to cache information from any Roles that are assigned to it, the Users would be the parents and the Roles would be the children, and it would be either a one or many relationship, depending on if a User can have multiple Roles. If you wanted each Role to store a list of all Users which have that role, the Roles would be the parents and the Users would be the children, and it would be an inverse or many-inverse relationship.

Collection.cache(options)

Posts.cache({
  type:'one',
  collection:Meteor.users,
  fields:['username', 'profile.firstName', 'profile.lastName'],
  referenceField:'author_id',
  cacheField:'author'
})
Property Valid values Description
type ‘one’, ‘many’, ‘inverse’ or ‘many-inverse’ one: The parent stores a single child _id many: The parent stores an array of child _ids inverse: Each child stores a single parent _id many-inverse: Each child stores an array of parent _ids
collection Mongo.Collection The “child collection”, from which docs will be cached
fields Array of Strings or Object The fields to include in the cache. It can either look like ['username', 'profile.email'] or {username:1, profile:{email:1}}. For “many”, “inverse” and “many-inverse”, _id will always be included.
referenceField String For “one” and “many”, the field on the parent containing _id of children. For “inverse” and “many-inverse”, the field on the children containing the _id of the parent.
cacheField String The field on the parent where children are cached. Can be a nested field, like 'caches.field', but it can not be in the same top level field as the referenceField. For type:'one', cacheField will store a single child. For all others, it will store an array of children.
bypassSchema Boolean (optional) If set to true, it will bypass any collection2 schema that may exist. Otherwise you must add the cacheField to your schema.
Notes and clarification:
  • “one” and “inverse” are many-to-one relationships (with “one”, a parent can only have one child, but many parents could have the same child). “many” and “many-inverse” are many-to-many relationships
  • When cacheField is an array (all types except “one”), the order of the children is not guaranteed.
  • When referenceField is an array, if it contains duplicate _ids, they will be ignored. The cacheField will always contain unique children.

Collection.cacheCount(options)

TodoLists.cacheCount({
  collection:Todos,
  referenceField:'list_id',
  cacheField:'counts.important',
  selector:{done:null, priority:{$lt:3}}
})

cacheCount() can be used on “inverse” and “many-inverse” relationships

Property Valid values Description
collection Mongo.Collection The collection in which docs will be counted
referenceField String The field on counted docs which must match the parent _id
cacheField String The field where the count is stored. Can be a nested field like 'counts.all'
selector Mongo selector (optional) Can be used to filter the counted documents. [referenceField]:parent._id will always be included though.
bypassSchema Boolean (optional) If set to true, it will bypass any collection2 schema that may exist. Otherwise you must add the cacheField to your schema.

Collection.cacheField(options)

Meteor.users.cacheField({
  fields:['profile.firstName', 'profile.lastName'],
  cacheField:'fullname',
  transform(doc){
    return doc.profile.firstName + ' ' + doc.profile.lastName
  }
})
Property Valid values Description
fields Array of Strings or Object The fields to watch for changes. It can either look like ['username', 'profile.email'] or {username:1, profile:{email:1}}
cacheField String Where the result is stored. Can be nested like 'computed.fullName'
transform Function (optional) The function used to compute the result. If not defined, the default is to return a string of all watched fields concatenated with ', '
The document provided to the function only contains the fields specified in fields
bypassSchema Boolean (optional) If set to true, it will bypass any collection2 schema that may exist. Otherwise you must add the cacheField to your schema.

Note: The transform function could also fetch data from other collections or through HTTP if you wanted, as long as it’s done synchronously.

Migration

If you decide to add a new cache or change the cache options on a collection that already contains documents, those documents need to be updated. There are two options for this:

migrate(collectionName, cacheField, [selector])

import {migrate} from 'meteor/herteby:denormalize'
migrate('users', 'fullName')
migrate('users', 'fullAddress', {fullAddress:{$exists:false}})

This updates the specified cacheField for all documents in the collection, or all documents matching the selector. Selector can also be an _id.

autoMigrate()

import {autoMigrate} from 'meteor/herteby:denormalize'
autoMigrate() //should be called last in your server code, after all caches have been declared

When autoMigrate() is called, it checks all the caches you have declared against a collection (called _cacheMigrations in the DB) to see wether they need to be migrated. If any do, it will run a migration on them, and then save the options to _cacheMigrations, so that it won’t run again unless you change any of the options. If you later for example decide to add another field to a cache, it will rerun automatically.

One thing it does not do is remove the old cacheField, if you were to change the name or remove the cache. That part you have to do yourself.

Note: it does not check the documents, it just checks each cache declaration, so it won’t thrash your DB on server start going through millions of records (unless something needs to be updated).

Nested referenceFields

For “one” and “inverse”, nested referenceFields are simply declared like referenceField:'nested.reference.field'

For “many” and “many-inverse”, if the referenceField is an Array containing objects, a colon is used to show where the Array starts.

Example:

If the parent doc looks like this:

{
  //...
  references:{
    users:[{_id:'user1'}, {_id:'user2'}]
  }
}

The referenceField string should be 'references.users:_id'

Recursive caching

You can use the output (the cacheField) of one cache function as one of the fields to be cached by another cache function, or even as the referenceField. They will all be updated correctly. This way you can create “chains” connecting three or more collections.

In the examples below, all cache fields start with _, which may be a good convention to follow for all your caches.

Use cacheField() to cache the sum of all cached items from a purchase
Bills.cacheField({
  fields:['_items'],
  cacheField:'_sum',
  transform(doc){
    return _.sum(_.map(doc._items, 'price'))
  }
})
Caching the cacheFields of another cache
Bills.cache({
  cacheField:'_items',
  collection:Items,
  type:'many',
  referenceField:'item_ids',
  fields:['name', 'price']
})
Customers.cache({
  cacheField:'_bills',
  collection:Bills,
  type:'inverse',
  referenceField:'customer_id',
  fields:['_sum', '_items']
})
Using the cacheField of another cache as referenceField
Customers.cache({
  cacheField:'_bills2',
  collection:Bills,
  type:'inverse',
  referenceField:'customer_id',
  fields:['item_ids', '_sum']
})
Customers.cache({
  cacheField:'_items',
  collection:Items,
  type:'many',
  referenceField:'_bills2:item_ids',
  fields:['name', 'price']
})
Incestuous relationships

With this fun title I’m simply referring to caches where the parent and child collections are the same.

Meteor.users.cache({
  cacheField:'_friends',
  collection:Meteor.users,
  type:'many',
  referenceField:'friend_ids',
  fields:['name', 'profile.avatar']
})

This works fine, but there is one thing you can not do - cache the cacheField of a document in the same collection - in this example it would be caching the friends of a users friends. This would lead to an infinite loop and infinitely growing caches.

When are the caches updated?

The caches for cache() and cacheCount() are updated immediately and synchronously.

Posts.cache({
  cacheField:'_author',
  //...
})
Posts.insert({_id:'post1', author_id:'user1'})
Posts.findOne('post1')._author //will contain the cached user

cache() uses 5 hooks: parent.after.insert, parent.after.update, child.after.insert, child.after.update and child.after.remove. There are then checks done to make sure it doesn’t do unnecessary updates.

Basically you should always be able to rely on the caches being updated. If they’re not, that should be considered a bug.

However, to avoid a complicated issue with “recursive caching”, the update of cacheField() is always deferred.

Meteor.users.cacheField({
  fields:['address', 'postalCode', 'city'],
  cacheField:'_fullAddress',
})
Meteor.users.insert({_id:'user1', ...})
Meteor.users.findOne('user1')._fullAddress //will not contain the cached address yet
Meteor.setTimeout(()=>{
  Meteor.users.findOne('user1')._fullAddress //now it should be there
}, 50)

Note: Since this package relies on collection-hooks, it won’t detect any updates you do to the DB outside of Meteor. To solve that, you can call the migrate() function afterwards.

Testing the package

meteor test-packages packages/denormalize --driver-package=practicalmeteor:mocha

(Then open localhost:3000 in your browser)
The package currently has over 120 tests
Note: The “slowness warnings” in the results are just due to the asynchronous tests

Download Details:

Author: Herteby

Source Code: https://github.com/Herteby/denormalize

#meteor #javascript

Simple Denormalization for Meteor

Zerdali Lion

1550285735

Meteor test driven development

I don't see how to do test driven development in meteor.

I don't see it mentioned anywhere in documentation or FAQ. I don't see any examples or anything like that.

I see that some packages are using Tinytest.

I would need response from developers, what is roadmap regarding this. Something along the lines of:

  • possible, no documentation, figure it out yourself
  • meteor is not built in a way that you can make testable apps
  • this is planned feature
  • etc


#meteor

Donna Keva

1550558948

What should I put in a meteor .gitignore file?

I have a new meteor project. I'm guessing the .meteor dir has a combination of configuration files (needed) and temporary files (not needed).

So what's in your .gitignore?

#meteor

Matthew Max

1550890217

Updating all Meteor packages to latest versions

I'm developing a Meteor app that isn't yet in production, so I can afford to move quickly when adopting new package versions (useraccounts had a significant version bump a few hours after I'd integrated it, for instance.) This was what I thought meteor update was meant to accomplish. Yet when I run:

meteor update

from my project, I'm told that packages were updated but .meteor/versions remains unchanged.

I can upgrade the package by running meteor add someone:[email protected], but this just shuffles the version dependency from .meteor/versions to .meteor/packages even though it seems to do the upgrade. I'm happy to lock versions down when I go to production, but it seems like in development I should be able to use the update command, especially as meteor list indicates that as a next step.

I've managed to upgrade all my packages by removing .meteor/versions and .meteor/local and running meteor update, but this seems messy.

I also found this issue but it was closed. Should it be reopened or should I open a new issue? I understand how semver works, but I think the issue is that Meteor isn't writing its constraint solver results to .meteor/versions so doesn't realize that package updates have been applied. Is that accurate or am I just misunderstanding something?

#meteor

Marietta  Huels

Marietta Huels

1608533160

Meteor js | Todo App Crash Course

Meteor js

This meteor js vs react js crash course can help you learn more about meteor js even uptill 20201.

meteor .js crash course for begginers, what we covered

  • Meteor installation on windows machine
  • Metero setup through the cli
  • meteor todo app tutorial

#meteor

Meteor js | Todo App Crash Course
Jane Aglo

Jane Aglo

1561470221

Which Hybrid-Framewok has more future? Ionic, React, or Meteor?

In the world of mobile app development, we’re always looking for shorter development cycles, quicker time to deployment, and better app performance. let's have a look over the following differences between Ionic, Meteor & React.

#react-native #ionic #meteor

Reload page content if database variable has changed Meteor

I am working on meteor app. I want to reload the content of the client when the database variable has changed. I am using pub-sub. I want to load content if the status variable has changed.

Meteor.publish('activities', function(loggedInUserToken) {
    var authObj = AuthenticationToken.findOne({ authToken: loggedInUserToken });
    if (authObj) {
        var userObj = Users.findOne({ _id: authObj.user_id });
        var activities = Activities.find({}, { sort: { createdAt: -1 } });
        return activities;
    }
    return this.ready();
});

Template.masterSku.onCreated(function() {
var instance = this;
instance.autorun(function() {
var loggedInUserToken = “xxxxxxxxxxxxxxxx”
statusSuscription = instance.subscribe(“activities”, loggedInUserToken);
var activitiesObj = Activities.findOne({}, { sort: { createdAt: -1 } })
if (activitiesObj && activitiesObj.status == “true”) {
console.log(“Status Changed load Content accordingly”)
}
})


#node.js #meteor

Elias  Ortiz

Elias Ortiz

1617245340

Full Stack Reactive Meteor and Svelte - Update and Delete

Full Stack Reactive Meteor and Svelte - Update and Delete

#meteor #svelte

Full Stack Reactive Meteor and Svelte - Update and Delete