Class

FeedCollection

api/feed.FeedCollection()

Represents a feed instance.

Constructor

# new FeedCollection()

Creates the Feed collection.

View Source api/feed/FeedCollection.ts, line 45

Extends

Methods

# assertAllDefined(names)

Verifies that the list of passed instances are all members of this collection.

Parameters:
Name Type Description
names

Should be a list of docs and/or docIDs.

Overrides:

View Source api/base/BaseCollection.ts, line 248

If instances is not an array, or if any instance is not in this collection.

Meteor.Error

# assertDefined(name)

Verifies that the passed object is one of this collection's instances.

Parameters:
Name Type Description
name String | List

Should be a defined ID or doc in this collection.

Overrides:

View Source api/base/BaseCollection.ts, line 238

If not defined.

Meteor.Error

# assertValidRoleForMethod(userId)

Asserts that userId is logged in as an Admin, Faculty, Student, or Advisor. This is used in the define, update, and removeIt Meteor methods associated with each class.

Parameters:
Name Type Description
userId

The userId of the logged in user. Can be null or undefined

Overrides:

View Source api/feed/FeedCollection.ts, line 480

If there is no logged in user, or the user is not in the allowed roles.

Meteor.Error

# checkIntegrity() → {Array}

Returns an array of strings, each one representing an integrity problem with this collection. Returns an empty array if no problems were found. Checks slugID, userID, opportunityID, and courseID. Note that userID, opportunityID, and courseID are all optional.

Overrides:

View Source api/feed/FeedCollection.ts, line 490

A (possibly empty) array of strings indicating integrity issues.

Array

# checkPastDayFeed() → {Object|boolean}

Returns a feedID with the same feedType (and opportunity, if feedType is Feeds.VERIFIED_OPPORTUNITY) if it exists within the past 24 hours. Returns false if no such feedID is found. Opportunity is required only if feedType is Feeds.VERIFIED_OPPORTUNITY

View Source api/feed/FeedCollection.ts, line 381

The feedID if found.

Object

False if feedID is not found.

boolean

# count() → {Number}

Returns the number of documents in this collection.

Overrides:

View Source api/base/BaseCollection.ts, line 41

The number of elements in this collection.

Number

# countNonRetired() → {Number}

Returns the number of non-retired documents in this collection.

Overrides:

View Source api/base/BaseCollection.ts, line 48

The number of non-retired elements in this collection.

Number

# define(feedDefinition)

Defines a new Feed instance.

Parameters:
Name Type Description
feedDefinition

An object representing the new Feed. feedDefinition must have a field named 'feedType' which should be one of the following strings: new-user, new-course, new-opportunity, new-verified-opportunity, new-course-review, or new-opportunity-review. Based upon the feedType, the object should contain additional fields providing the information necessary to define that new feed.

Overrides:

View Source api/feed/FeedCollection.ts, line 96

# defineNewCourse(description)

Defines a new Feed (new course).

Parameters:
Name Type Description
description Object

Object with keys course, feedType, and timestamp.

View Source api/feed/FeedCollection.ts, line 199

If not a valid course.

Meteor.Error

The newly created docID.

Example
Feeds._defineNewCourse({ feedType: Feeds.NEW_COURSE,
                       course: 'ics_100'
                       timestamp: '12345465465', });

# defineNewCourseReview(description)

Defines a new Feed (new course review).

Parameters:
Name Type Description
description Object

Object with keys user, course, feedType, and timestamp. User can either be the string username or an array containing a single username.

View Source api/feed/FeedCollection.ts, line 299

If not a valid course or user.

Meteor.Error

The newly created docID.

Example
Feeds.defineNewCourseReview({ feedType: Feeds.NEW_COURSE_REVIEW,
                             user: 'abi@hawaii.edu',
                             course: 'ics_111'
                             timestamp: '12345465465', });

# defineNewOpportunity(description)

Defines a new Feed (new opportunity).

Parameters:
Name Type Description
description Object

Object with keys opportunity, feedType, and timestamp.

View Source api/feed/FeedCollection.ts, line 225

If not a valid opportunity.

Meteor.Error

The newly created docID.

Example
Feeds._defineNewOpportunity({ feedType: Feeds.NEW_OPPORTUNITY,
                            opportunity: 'att-hackathon'
                            timestamp: '12345465465', });

# defineNewOpportunityReview(description)

Defines a new Feed (new opportunity review).

Parameters:
Name Type Description
description Object

Object with keys user, opportunity, feedType, and timestamp. User can either be the string username or an array containing a single username.

View Source api/feed/FeedCollection.ts, line 328

If not a valid opportunity or user.

Meteor.Error

The newly created docID.

Example
Feeds._defineNewOpportunityReview({ feedType: Feeds.NEW_OPPORTUNITY_REVIEW,
                                  user: 'abi@hawaii.edu',
                                  opportunity: 'att-hackathon'
                                  timestamp: '12345465465', });

# defineNewUser(description)

Adds user to the Feed. If there is no new-user feed within the past day, then a new Feed is created and its docID is returned. If there is a new-user feed within the past day, then this user is added to that Feed instance and its docID is returned.

Parameters:
Name Type Description
description Object

Object with keys user and timestamp. Note that user can be either a single username string or an array of usernames.

View Source api/feed/FeedCollection.ts, line 168

If not a valid user.

Meteor.Error

The newly created docID.

Example
Feeds._defineNewUser({ feedType: Feeds.NEW_USER,
                     user: 'abi@hawaii.edu',
                     timestamp: '12345465465' });

# defineNewVerifiedOpportunity(description)

Adds the verified opportunity to the Feed. If there is no verified-opportunity feed within the past day, then a new Feed instance is created and its docID is returned. If there is a verified-opportunity feed within the past day, then this info is added to it and its docID is returned.

Parameters:
Name Type Description
description Object

Object with keys user, opportunity, academicTerm, feedType, and timestamp. Note that user can be either a single username string or an array of usernames.

View Source api/feed/FeedCollection.ts, line 258

If not a valid opportunity, academicTerm, or user.

Meteor.Error

The docID associated with this info.

Example
Feeds.defineNewVerifiedOpportunity({ feedType: Feeds.VERIFIED_OPPORTUNITY,
                                     user: 'abi@hawaii.edu',
                                     opportunity: 'att-hackathon'
                                     academicTerm: 'Spring-2013'
                                     timestamp: '12345465465', });

# dumpAll() → {Object}

Returns an object with two fields: name and contents. Name is the name of this collection. Contents is an array of objects suitable for passing to the restore() method.

Overrides:

View Source api/base/BaseCollection.ts, line 277

An object representing the contents of this collection.

Object

# dumpOne(docID) → {Object}

Returns an object representing the Feed docID in a format acceptable to define().

Parameters:
Name Type Description
docID

The docID of a Feed.

Overrides:

View Source api/feed/FeedCollection.ts, line 515

An object representing the definition of docID.

Object

# find(selector, options) → {Mongo.Cursor}

Runs find on this collection.

Parameters:
Name Type Description
selector Object

A MongoDB selector.

options Object

MongoDB options.

Overrides:
See:

View Source api/base/BaseCollection.ts, line 101

Mongo.Cursor

# findDoc(name) → {Object}

A stricter form of findOne, in that it throws an exception if the entity isn't found in the collection.

Parameters:
Name Type Description
name String | Object

Either the docID, or an object selector, or the 'name' field value.

Overrides:

View Source api/base/BaseCollection.ts, line 76

If the document cannot be found.

Meteor.Error

The document associated with name.

Object

# findNonRetired(selector, options) → {Array}

Runs find on this collection and returns the non-retired documents.

Parameters:
Name Type Description
selector Object

A MongoDB selector.

options Object

MongoDB options.

Overrides:
See:

View Source api/base/BaseCollection.ts, line 112

non-retired documents.

Array

# findOne(selector, options) → {Mongo.Cursor}

Runs findOne on this collection.

Parameters:
Name Type Description
selector Object

A MongoDB selector.

options Object

MongoDB options.

Overrides:
See:

View Source api/base/BaseCollection.ts, line 123

Mongo.Cursor

# getCollection() → {Mongo.Collection}

Returns the Mongo collection.

Overrides:

View Source api/base/BaseCollection.ts, line 223

The collection.

Mongo.Collection

# getCollectionName() → {string}

Returns the collection name.

Overrides:

View Source api/base/BaseCollection.ts, line 216

The collection name as a string.

string

# getCollectionSchema() → {SimpleSchema}

Returns the schema applied to the collection.

Overrides:

View Source api/base/BaseCollection.ts, line 188

.

SimpleSchema

# getDefineSchema() → {SimpleSchema}

Returns a schema for the define method's parameter.

Overrides:

View Source api/base/BaseCollection.ts, line 195

the define method's parameter.

SimpleSchema

# getPublicationName() → {String}

Return the publication name.

Overrides:

View Source api/base/BaseCollection.ts, line 209

The publication name, as a string.

String

# getType() → {String}

Return the type of this collection.

Overrides:

View Source api/base/BaseCollection.ts, line 181

The type, as a string.

String

# getUpdateSchema() → {SimpleSchema}

Returns a schema for the update method's second parameter.

Overrides:

View Source api/base/BaseCollection.ts, line 202

.

SimpleSchema

# isDefined(name) → {boolean}

Returns true if the passed entity is in this collection.

Parameters:
Name Type Description
name String | Object

The docID, or an object specifying a documennt.

Overrides:

View Source api/base/BaseCollection.ts, line 144

True if name exists in this collection.

boolean

# publish()

Publish a maximum of the last 25 feeds to users

Overrides:

View Source api/feed/FeedCollection.ts, line 541

# removeAll()

Removes all elements of this collection. This is implemented by mapping through all elements because mini-mongo does not implement the remove operation. So this approach can be used on both client and server side. removeAll should only used for testing purposes, so it doesn't need to be efficient.

Overrides:

View Source api/base/BaseCollection.ts, line 170

true

# removeIt(name)

A stricter form of remove that throws an error if the document or docID could not be found in this collection.

Parameters:
Name Type Description
name String | Object

A document or docID in this collection.

Overrides:

View Source api/base/BaseCollection.ts, line 157

true

# removeUser(user)

Removes all Feed documents referring to user.

Parameters:
Name Type Description
user

The user, either the ID or the username.

View Source api/feed/FeedCollection.ts, line 469

If user is not an ID or username.

Meteor.Error

# restoreAll(dumpObjects)

Defines all the entities in the passed array of objects.

Parameters:
Name Type Description
dumpObjects

The array of objects representing the definition of a document in this collection.

Overrides:

View Source api/base/BaseCollection.ts, line 315

# restoreOne(dumpObject) → {String}

Defines the entity represented by dumpObject. Defaults to calling the define() method if it exists.

Parameters:
Name Type Description
dumpObject

An object representing one document in this collection.

Overrides:

View Source api/base/BaseCollection.ts, line 305

The docID of the newly created document.

String

# subscribe()

Default subscription method for entities. It subscribes to the entire collection.

Overrides:

View Source api/base/BaseCollection.ts, line 64

# toString() → {String}

Returns a string representing all of the documents in this collection.

Overrides:

View Source api/base/BaseCollection.ts, line 230

String

# update(docID)

Update a Feed instance

Parameters:
Name Type Description
docID

The docID to be updated. Description, pictures, users, opportunity, course, and academicTerm can be updated. The timestamp and feedtype fields cannot be updated once created.

View Source api/feed/FeedCollection.ts, line 127

If docID is not defined, or if users, opportunity, or course are not defined.

Meteor.Error

# updateNewUser(userID)

Updates the existingFeedID with the new userID information

Parameters:
Name Type Description
userID

the new userID, existingFeedID the existing feed of the same type within the past 24 hours

View Source api/feed/FeedCollection.ts, line 429

If username is not a username, or if existingFeedID is not a feedID.

Meteor.Error

# updateVerifiedOpportunity(userID)

Updates the existingFeedID with the new userID information

Parameters:
Name Type Description
userID

the new userID, existingFeedID the existing feed of the same type within the past 24 hours

View Source api/feed/FeedCollection.ts, line 454

If username is not a username, or if existingFeedID is not a feedID.

Meteor.Error