Collections not showing in mongodb

I’m not able to see(on mongodb) some of the collections I created ,but some of them show. I can’t find any difference between the collections that are showing and those that are not. Neither of the collections have any records inside which confuses as to how one is showing in mongodb but not the other.

Collection that shows up in mongodb

import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
export const Universities = new Mongo.Collection('unis');

Universities.allow({
    insert: () => false,
    update: () => false,
    remove: () => false,
})
Universities.deny({
    insert: () => true,
    update: () => true,
    remove: () => true,
})


UniversitySchema = new SimpleSchema({
    name: {
        type: String,
        label: 'University Name',
        unique: true
    }
});

Universities.attachSchema(UniversitySchema);

Collection that does not shows up in mongodb

import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';

export const Departments = new Mongo.Collection('departments');

Departments.allow({
    insert: () => false,
    update: () => false,
    remove: () => false
});
Departments.deny({
    insert: () => true,
    update: () => true,
    remove: () => true
});

DepartmentSchema = new SimpleSchema({
    department_name:{
        type:String,
        label:'Department Name',
    },
    faculty_id:{
        type: String,
        label: 'Faculty'
    }
});

Departments.attachSchema(DepartmentSchema);

Check out second collection’s existence in some mongo browsing tools like MongoChef. If it’s not there - smth wrong wit you code

@avalanche1 It still seems to only show only some of the collections like it did before. I checked the other collection’s code and there doesn’t seem to be anything wrong ,if they had any errors the collections appearing would have the same problem.

You have to pinpoint the root cause of probs with 2nd coll by stripping away parts of the scaffolding.
I’d start with removing simpleschema, then removing allow\deny and so on…

Collections only show if they have documents – are they empty?

1 Like

@avalanche1 No change in doing that too

they’re all empty, for both collections(those are showing and those that are not).

Remove everything from the project, but aforementioned piece of code - see if it works.

Meteor collections are created lazily. They will only be created when they are first written to. Once created, even if all documents are removed, they will continue to exist as empty collections.

I thought this might be the case,will just put up with this.Thanks!