Yogiben Admin - Schema problem


Hi there!
I have some specific problem.
I use MeteorJS and installed yogiben:admin. I tried to build some schema, but I have an error after updating something.
I want to add that I have subpages in page, maybe that’s the problem?

That’s what I get after adding items to my invoice:

As I can see in the picture, the problem is with some modifier and with “After.Update.sum”. I use function that use “sum”.

In my "server/collections/invoices_item.js"
I have:

InvoicesItem.after.update(function(userId, doc, fieldNames, modifier, options) {
var sum = 0; InvoicesItem.find({ invoiceId: doc.invoiceId }).map(function(item) { sum += item.amount; }); Invoices.update({ _id: doc.invoiceId }, { $set: { totalAmount: sum }});

Than I saw that problem could be with “totalAmount:sum”. I use
Chrome, so I tried “console.log()” to see if the page takes my
And it doesn’t.

I use Chrome, so I tried to see what the console will give me. I have something like this:

I did sth like that in my code on server side:

Meteor.publish("fakturka", function(invoiceId) {
    return Invoices.find({_id:invoiceId,ownerId:this.userId}, {});

And did that on client side:

this.InvoicesNewInsertController = RouteController.extend({ 
template: "InvoicesNew",            
    yieldTemplates: {
        'InvoicesNewInsert': { to: 'InvoicesNewSubcontent'}         
    onBeforeAction: function() {
    action: function() {
        if(this.isReady()) { this.render(); } else { this.render("InvoicesNew"); this.render("loading", { to: "InvoicesNewSubcontent" });}
    isReady: function() {               
        var subs = [
            Meteor.subscribe("fakturka", this.params.invoiceId),
            Meteor.subscribe("invoices_itemss_faktura", this.params.invoiceId)
        var ready = true;
        _.each(subs, function(sub) {
                ready = false;
        return ready;
    data: function() {              
        return {
            params: this.params || {},
            invoices_item: InvoicesItem.find({}, {}),
            invoiceeeee: Invoices.find({}, {}),
            customers: Customers.find({}, {}),
            fakturka: Invoices.findOne({_id:this.params.invoiceId}, {}),
            invoices_item_empty_faktura: InvoicesItem.findOne({_id:null}, {}),
            invoices_itemss_faktura: InvoicesItem.find({invoiceId:this.params.invoiceId}, {})
    onAfterAction: function() {

After removing that code from: both/collections/invoices.js

Schemas.Invoicess = new SimpleSchema({

“fakturka” is visible. After adding that code - “fakturka” in undefined.

I’m sorry for so much code, but I really want to solve that problem and I
want to give so much info as I could. Please, help me to solve my


Man that is alot of code… :smile: before anyone reads through that, have you tried searching for:

When the modifier option is true yogiben admin
validation object must have at least one operator yoiben admin

I’ve had related issues myself, if you search for the error wrt the package you’re using either on the github project, in this forum, or google as last resort, you should find similar patterns of issues.


I’ve read that, but that didn’t help me a lot. :frowning:
I know it’s a lot of code, but I try to give everything here.


I see it’s problem with getting the collection.

When I use the schema in my “both/collections/invoices.js” the “fakturka” is gone (undefined). When I don’t use the schema, “fakturka” is ready to be seen. That’s the problem.


Any idea of solving the problem? I’m getting frustrated, because I don’t know what it is. Is it a bug or sth…


I thought you said in your last post that you had found it no?

I’ve tried reading your code, it’s really hard to understand from the formatting.

I think to get more responses, you need to


// use Markdown formatting
example: function () {
    // comment
    if (blah) {
        // stuff

Simplify your question. Focus on one error, the first.