Yes documentation is not detailed enough. When you create a new document:
var u = new User();
You have to insert it into collection using:
user.insertAt(0);
You don't use the save()
method.
To get documents already sorted you have to use:
User.find();
Notice that it's the class constructor not collection.
_original
object inside data I retrieve from mongo. I tried to exclude it via Things.find({}, {fields: {_original: 0}}).fetch()
but it still comes through. is this costing me anything in terms of bandwidth? or is it something added on with astronomy that doesn't go through the DDP connection?
DelegateId: {
type: 'string',
default:''
},
Delegate: {
type: 'string',
default:'',
transient: true
},
relations: {
delegate: {
type: 'one',
class: 'Contact',
local: 'DelegateId',
foreign: '_id'
}
},
@cyrus-za you first create your collection passing in the idGeneration
option:
MyCollection = new Mongo.Collection('mycollection', {idGeneration: 'MONGO'});
and then use either simple-schema/collection2 or astronomy at will. Neither should complain.
But beware of the Meteor.users
collection which, by default always uses STRING
id's and you cannot change that meteor/meteor#1834
If I use this:
var app = new App();
Template.XXX.helpers({
app() { return app; }
});
and later on I change app with set()
... then validate()
and then save()
... things in the template are not-reactive:
This won't update {{app.url}} if coming from that helper, even if it's saved in Minimongo via save().
If I want it to be reactive, I have to change the helper to something like:
Template.XXX.helpers({
app() { return Apps.findOne(_id); }
});
with the _id
of the previously saved app object.
Do you have plans to make a new
Astro object reactive by itself without having to change it for a Minimongo query after saving?