Questions tagged [simple-schema]

A simple, reactive schema validation package for Meteor. It's used by the Collection2 and AutoForm packages, but you can use it by itself, too.

258 questions
1
vote
2 answers

Subschema as array item with AutoForm, SimpleSchema

I am trying to get subschemas to work as an array, which I assume is the correct way to handle my problem (but please correct me if I am wrong!). I provide a simplified working example to show my problem, based on the BooksSchema example provided by…
WalterB
  • 110
  • 2
  • 12
1
vote
0 answers

Meteor Simple Schema $addToSet Fails

All, I have the following schema. const FeedSchema = new SimpleSchema({ userId: { type: String, }, date: { type: Date, }, summary: { type: String, }, text: { type: String, optional: true, …
Dan Grahn
  • 9,044
  • 4
  • 37
  • 74
1
vote
1 answer

Validation fails but insertion succeeds in Simple-Schema

So I'm using Simple-Schema/Collection2, and I thought my schema definitions were fine, as they caught malformed fields, and records inserted succesfully when properly formed. However, I'm trying to run MySchemas.Schema.validate(document) and running…
mstorkson
  • 1,130
  • 1
  • 10
  • 26
1
vote
0 answers

Meteor Collection 2 Re-Use Array Items From Same Collection for AutoForm

I have a collection with a few arrays. I am using autoform to display various forms. I need to pull in the existing data from the same _id into a different form field. Here is my document with data: { "_id": "ERjvecg2GmSBktmn5", …
1
vote
1 answer

Javascript function is executed before it is called

I have a javascript function complaining that a call within its body is not a function before it is called. Could someone please help me explain this? Context: I am using Meteor and Collection2 and I would like to use a function for reuse at…
1
vote
1 answer

fileLink is not allowed by schema

I'm trying to use Simple Schema in my current Meteor React project but for some reason I can't get it to work. This is my schema: Comments.schema = new SimpleSchema({ city: { type: String, label: 'The name of the city.' }, …
Deelux
  • 1,045
  • 2
  • 12
  • 26
1
vote
1 answer

Populate subdocument in Meteor

I have a schema which has a subdocument defined by another schema like so: Child schema export const Child = new Mongo.Collection('Child'); Child.schema = new SimpleSchema({ ... }); Child.attachSchema(Child.schema); Parent schema export const…
Anubhav Dhawan
  • 1,431
  • 6
  • 19
  • 35
1
vote
0 answers

Simple Schema min rule is not giving error

I am trying to update with $push and $inc at the same time , every thing is working fine but the problem is when I $inc my field with negative values its minimum value shouldn't be less that 0 as I have set the rule min in my schema but it does not…
Piyush Kumar
  • 481
  • 1
  • 6
  • 17
1
vote
0 answers

Simple Schema allowing non-optional empty strings?

I'm starting to use Simple Schema for validation on some forms and am perplexed as to why a non-optional empty string is not invalid? I would it expect it to be allowed on an optional field, but not required... perhaps I'm not understanding how it's…
Scott
  • 3,204
  • 3
  • 31
  • 41
1
vote
1 answer

How to use node-simple-schema reactively?

Given that there is not much examples about this, I am following the docs as best as I can, but the validation is not reactive. I declare a schema : import { Tracker } from 'meteor/tracker'; import SimpleSchema from 'simpl-schema'; export const…
Yanick Rochon
  • 51,409
  • 25
  • 133
  • 214
1
vote
0 answers

When editing an existing document in React, Meteor Simple Schema validation on client side always returns 'true', despite invalid form data

I have a form component in React that can be used to either save a new address, or edit an existing address object in MongoDB. I am using SimpleSchema for client-side schema validation (as well as server-side schema validation). The document is…
ryder
  • 897
  • 6
  • 15
1
vote
2 answers

Meteor simple schema issue

I'm getting null array value in main_categories. My schema is for brand collection: Schema Definition Schema.main_category = new SimpleSchema({ name: {type: String}, icon_image: {type: String}, description: {type:…
Pradeep Saini
  • 680
  • 6
  • 17
1
vote
1 answer

Meteor SimpleSchema says random stuff is valid

I'm using aldeed:collection2 and aldeed:simple-schema packages. I want to validate a doc against the schema. My schema contains e.g. a string field with allowedValues array and an array of nested object, described with sub-schema. Like…
tristantzara
  • 5,597
  • 6
  • 26
  • 40
1
vote
0 answers

Autoform custom validation fails after multiple subsqeuent submits

I'm using a custom validation on _id field as below. First I enter an ID and hit submit, it gets persisted in the DB. Next time, I reuse the same ID and try to submit, I get a validation error. I hit the submit button again, and I get a weird…
1
vote
2 answers

Meteor SimpleSchema Repeated Nested Objects

I'm wondering if there's a simple way of doing this. First this is my current schema: Test.schema = new SimpleSchema({ owner: { type: String, label: 'Owner of the test', }, name: { type: String, label: 'Name of the test', }, …
cocacrave
  • 2,453
  • 4
  • 18
  • 30