0

I am fetching data from Mongo Database using Collections but it not returning any data while fetching but when i insert data it then returns fetch call .

Template.message.events({
    'click #tag_message-actions__button' : function(){
            const { msg } = this;
            console.log("msgg",this);
            TaggedMessages.insert({
            message:msg.msg,
            messageId : msg._id,
            taggedAt: new Date(),
        }); 

    }
});

This for fetching

const nnn = TaggedMessages.find().forEach((item) => { 
    console.log("teggitem",item)
});
// const nnn =TaggedMessages.find({},{messageId :  msg._id})
console.log("tegg",TaggedMessages.find())

Here i am allowing to to insert using Meteor.allow in server side

import { Mongo } from 'meteor/mongo';

var TaggedMessages = new Mongo.Collection('rocketchat_taggedmessages');
TaggedMessages.allow({
  insert: function (userId, doc) {
         return true;
  },
  update: function (userId, doc, fieldNames, modifier) {
         return true;
  },
  remove: function (userId, doc) {
         return true;
  },

});
Jankapunkt
  • 8,128
  • 4
  • 30
  • 59
Wahdat Jan
  • 3,988
  • 3
  • 21
  • 46

0 Answers0