Questions tagged [meteor-collection2]

meteor-collection2 is a package for specifying a schema for collections in Meteor.

meteor-collection2 is a package for specifying a schema for collections in Meteor.

199 questions
12
votes
1 answer

Storing arbitrary object inside a field with meteor simple schema

I have a schema with a field type: Object . But whenever i do an insert, that object is empty. Here is my schema Contacts.attachSchema(new SimpleSchema({ firstName: { type: String, }, lastName: { type: String, …
Mustafa
  • 1,738
  • 2
  • 24
  • 34
11
votes
4 answers

Separate form validation with Meteor

I'm using collection2 and I'm trying to get it to handle validation is a specific way. I have a profile schema which looks kind of like this: Schema.UserProfile = new SimpleSchema({ name: { type: String, optional: false } …
SeanWM
  • 16,789
  • 7
  • 51
  • 83
9
votes
2 answers

Meteor collection not being created automatically on start and autoform doesn't post to mongo db

I am new to meteor and mongo db. I am making an application using meteor@1.3.4.1. I am making a file named '/imports/api/collections/recipe.js'. Here I am creating a collection and importing this file into both '/server/main.js' and…
8
votes
1 answer

No best common type exists among return expressions

When I use Collection2 in angular2-meteor project, these kinds of codes from demo always give me warning in the terminal: No best common type exists among return expressions. How can I improve the codes? Thanks { createdAt: { type: Date, …
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
7
votes
1 answer

ObjectId in simpleSchema or collection2

I am just playing around with meteor and started using simple-schema and collection2. I moved from mongoose and node so my question could be a bit noob, so bear with me. In mongoose I could just add a type called schema.ObjectId,in some field to…
Suman Lama
  • 946
  • 1
  • 9
  • 26
6
votes
2 answers

Using objects as options in Autoform

In my Stacks schema i have a dimensions property defined as such: dimensions: { type: [String], autoform: { options: function() { return Dimensions.find().map(function(d) { return { label: d.name, value:…
Chris
  • 9,603
  • 15
  • 46
  • 67
6
votes
1 answer

Meteor using namedContext to addInvalidKeys to an AutoForm form returning an error

I have the following SimpleSchema where I am trying to add custom validation to validate against entering duplicate customer name, yet whenever I try to save a new customer I get error: Exception in delivering result of invoking …
MChan
  • 6,842
  • 27
  • 83
  • 132
5
votes
2 answers

How to add a collection2 schema to users collection using accounts-password package in meteorjs?

So, I have just started a meteor project and have included the accounts-password package. The package only supports few keys. I want to add a new SimpleSchema to the users collection with some more fields. I am not given to create another instance…
5
votes
1 answer

Verifying schema on Meteor Method using autoform

I'm using autoform, collection2. I want to use method call type for insert/update, as I want to add additional fields before saving to database in server. SimpleSchema would check the data in client, but how can I make the data is checked against…
Ahmet Cetin
  • 3,683
  • 3
  • 25
  • 34
4
votes
3 answers

Is it possible to sort a collection only once and then keep that order intact despite reactivity?

I have a list of Comments. These comments have an attribute called "vote" (users can vote comments) and they are initially sorted by votes (descending, onRender). Right now, when users vote, the order of the comments is reactively updated to reflect…
Cos
  • 1,649
  • 1
  • 27
  • 50
4
votes
2 answers

AutoValue not set in AutoForm with Meteor method

I have an insert form which is created using autoform, collection2 and simple schema. The createdBy field is populated with the userId using autovalue. The form worked when using meteor.allow() for the insert but I wanted to replace the allow with a…
4
votes
1 answer

Meteor simple-schema array should have defaultValue none

I have a form for people to create an event that will later have members, though not at time of creation. When the event is created, no members should be added, so the autoform shows no member field: createEvent.jade template(name="createEvent") …
KindOfGuy
  • 3,081
  • 5
  • 31
  • 47
4
votes
2 answers

On Meteor, how can I validate with Collection2 on the client side?

I always use methods to insert, update and remove. This is the way my code look just now: Client side Template.createClient.events({ 'submit form': function(event, tmpl) { e.preventDefault(); var client = { name:…
Camilo
  • 2,844
  • 2
  • 29
  • 44
4
votes
1 answer

How to implement Collection2 on a working Meteor project?

The documentation for Collection2 explains how to create a Schema, and how to attach the Schema to a collection, but I think a full working example with insert/update forms, with error handling, and without autoform, is missing. How do I change my…
aBe
  • 422
  • 3
  • 9
4
votes
1 answer

How to pass a default value for a field in 'insert' form?

How to pass a default value for a field in 'insert' form? I'm using Meteor's packages: Autoform, Collections2, and Simple-Schema. My process is: A User selects some value in a list on a page, then The 'insert' from opens, and I want that one field…
1
2 3
13 14