I am trying to create a two column unique index on the underlying mongodb in a meteor app and having trouble. I can\'t find anything in the meteor docs. I have tried from
Actually why not use upsert on the server with a Meteor.method and you could also send also track it with a ts: // Server Only
Meteor.methods({
add_only_once = function(id1,id2){
SomeCollection.update(
{first_id:id1,another_id:id2},{$set:{ts:Date.now()}},{upsert:True});
}
});
// Client
Meteor.call('add_only_once',doc1._id, doc2._id);
// actual code running on server
if(Meteor.is_server) {
Meteor.methods({
register_code: function (key,monitor) {
Codes.update({key:key},{$set:{ts:Date.now()}},{upsert:true});
}
...