Shahid Shabbir
Shahid Shabbir

Reputation: 25

Meteor quickforms and simple-schema not working

I am using the following code in cars.js which is in lib folder,

       Cars = new Mongo.Collection('cars');

    Cars.allow({
      insert: function(userid, doc) {
        return !!userid;
      }
    });

    CarSchema = new SimpleSchema({

    name: {
            type: String,
            label: "Cars"
          },

    desc: {
            type: String,
            label: "Car Condition"
          },

    author: {

            type: String,
            label: "Author",
            autoValue: function() {
              return this.userid
            },
            autoform: {
              type: "hidden"
            }
    },

    createdAt: {
                type: Date,
                label: "Created at",
                autoValue: function() {
                  return new date()
                },
                autoform: {
                  type: "hidden"
                }
              }

    });

    Cars.attachSchema ( CarSchema );

this is quickform code,

    <template name="newcar">
    <div class="new-car-container">
      {{> quickForm collection="Cars" id="insertcarform" type="insert" class="new-car-form"}}
    </div>
    </template>

I see a form UI but when I go to mongodb shell and show collections, I dont see my collections named 'cars' there.

P.s. I am very new coder and learner, please help me with this and if possible explain in detail how to fix it. Thanks

Upvotes: 1

Views: 141

Answers (0)

Related Questions