S
S
Sergey2015-03-10 08:45:31
JavaScript
Sergey, 2015-03-10 08:45:31

How to save to Meteor collection?

Happy new work week everyone.
Tell me, how to save such a construction to the collection in Meteor

en {title : 'Hello'},
           ru {title : 'Привет' }
for multilingualism.
Need something like this
Template.condSubmit.events({
 'submit form': function(e) {
    e.preventDefault();
var cond = {

  en : title: $(e.target).find('[name=entitle]').val(),
  ru : title: $(e.target).find('[name=frtitle]').val()
};
cond._id = Cond.insert(cond);   
 }
});

But this is not the correct syntax, but what is the correct one to describe the en.title and ru.title fields for saving?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-03-10
@TsarS

I don't know anything about Meteor, but in pure js it should be like this:

var cond = {
    en: {title: $(e.target).find('[name=entitle]').val()},
    ru: {title: $(e.target).find('[name=frtitle]').val()}
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question