Mongol not reflecting that collection is being updated

Some assistance please…

I am able to submit my collection data and after doing a db.dbname.find(), it does reflect the data that I have captured in the database.

However on my meteor toys, mongol interface, I dont see anything.

I have created a subscription on the client side, as such:

Meteor.subscribe('patients');

and also a publish on the server side

Meteor.publish('patients', function(){
	return 
	Patients.find({author: this.userId});
});

Still though, I cant see it on my mongol screen when I click on my collection.

My collection is structured as follows:

Patients = new Mongo.Collection('patients');

Patients.allow({
	insert: function(userId, doc) {
		return !!userId;
	},
	update: function(userId, doc) {
		return !!userId;
	}
});

Complaint = new SimpleSchema({
	description: {
		type: String
	},
	severity: {
		type: String
	}
});


PatientSchema = new SimpleSchema({
	FirstName: {
		type: String,
		label: "First Name"
	},
	LastName: {
		type: String,
		label: "Last Name"	
	},
	IdentityNumber: {
		type: Number,
		label: "Identity Number"
	},
	Address: {
		type: String,
		label: "Address"
	},
	PhoneNumber: {
		type: Number,
		label: "Phone Number"
	},
	Complaint: {
      type: [Complaint]
	},
	inHistory: {
		type: Boolean,
		defaultValue: false,
		optional: true,
		autoform: {
			type: "hidden"
	   }
	},
	Author: {
		type: String,
		label: "Author",
		 autoValue: function(){
         return this.userId;
      },
      autoform: {
            type: "hidden", 
            label: false,
		 },
		
		},
	createdAt: {
		type: Date,
		label: "Created At",
		autoValue: function() {
			return new Date()
		},
		autoform: {
			type: "hidden"
		}
	}
});

Meteor.methods({
	toggleRecordItem: function(id, currentState) {
		Patients.update(id, {
			$set: {
				inRecord: !currentState
			}
		});
	},
	deletePatient: function(id) {
		Patients.remove(id);
	}
});


Patients.attachSchema( PatientSchema );

Strange issue - can you provide a list of packages?

Btw, moving Mongol to the top of your package list tends to solve most problems.

hi, there thanks for getting back to me, seems to still be an issue, even if I move the package up.

packages below:

# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

meteor-base@1.0.4             # Packages every Meteor app needs to have
mobile-experience@1.0.4       # Packages for a great mobile UX
mongo@1.1.12                   # The database Meteor supports right now
blaze-html-templates@1.0.4    # Compile .html files into Meteor Blaze views
reactive-var@1.0.10            # Reactive variable for tracker
jquery@1.11.9                  # Helpful client-side library
tracker@1.1.0                 # Meteor's client-side reactive programming library

standard-minifier-css@1.2.0   # CSS minifier run for production mode
standard-minifier-js@1.2.0    # JS minifier run for production mode
es5-shim@4.6.14                # ECMAScript 5 compatibility for older browsers.
ecmascript@0.5.8              # Enable ECMAScript2015+ syntax in app code
shell-server@0.2.1            # Server-side component of the `meteor shell` command

meteortoys:allthings
kadira:flow-router
kadira:blaze-layout
erasaur:meteor-lodash
fortawesome:fontawesome
spiderable
fastclick
raix:handlebar-helpers
aldeed:collection2
aldeed:autoform
accounts-ui
accounts-password
matb33:bootstrap-glyphicons
zimme:active-route
gwendall:auth-client-callbacks
aldeed:simple-schema
datariot:ganalytics
mquandalle:stylus

if you do a find().fetch() on a collection does it return all the docs?

Hi there, yes it does return a record

{
        "_id" : "dcXfvRoqJNQqGbkJt",
        "FirstName" : "Joe",
        "LastName" : "Blogs",
        "IdentityNumber" : 123456,
        "Address" : "15 Ace Ave, Aventura , 2194",
        "PhoneNumber" : 837856754,
        "Complaint" : [
                {
                        "description" : "headache",
                        "severity" : "extremely painful"
                }
        ],
        "inHistory" : false,
        "User" : "AmbdudNv37emN9mRF",
        "createdAt" : ISODate("2016-09-04T06:30:17.306Z")
}

Following this with interest (unfortunately too noobie to help) - Just want to say that I’m a huge fan of Mongol @msavin - thanks!

1 Like

It is indeed a great package, I actuallly got this working by changing my server side code to:

Meteor.publish('Patients', function(){
    return Patients.find();
});
1 Like

hmm, that us strangev🤔 but glad it started working

Return on a new line is a call. The ; is not required. So the last line just won’t get executed because return ends the function.

Meteor.publish('patients', function(){
	return 
	//Patients.find({author: this.userId});
});

This is the same when executing.

Edit, explanation why it happens: http://stackoverflow.com/a/8528606

yes, but for some reason tour collections were still syncing

Yes it is, agree on that. Might be another publication or subscription which got triggered in some way.

I am having this same issue right now. Using msavin:mongol to check if the collection is subscribed to on client, the collections are there, but no data. Helpers are not getting required data, so the app is broken at the moment. It happened after I hibernated my Windows 10 PC. When I returned, I refreshed the app, and it was broken. db.ph.find().pretty() returns data in the collection, so it’s not mongo. Could it be DDP?. Please help. My deadline is near. Thanks iin advance.