Reputation: 1074
This is probably a dumb question but I've been everywhere (official docs, discover meteor, SO, several blogs...) and I just can't sort this out. Part of the problem is probably because I'm very used to relational dbs and I could be wrong about MongoDB ways of work and I don't know how to approach this.
Anyway, I'm writing a test application as an exercise to learn something about meteor and I'm stuck in trying to save an array of tags related to a single item. I know how to save plain data:
Tasks.insert({
text: text,
createdAt: new Date(),
owner: Meteor.userId(),
username: Meteor.user().username
});
how do I save a related list of tags?
Upvotes: 0
Views: 66
Reputation: 9533
You can just save the array.
tags = ['hot', 'spicy', 'green']
Tasks.insert({
tags: tags,
text: text,
createdAt: new Date(),
owner: Meteor.userId(),
username: Meteor.user().username
});
Upvotes: 3