Class

UserInteractionCollection

api/user~UserInteractionCollection()

UserInteractionCollection, colletion of user interactions with HACC-Hui application.

Constructor

# new UserInteractionCollection()

View Source api/user/UserInteractionCollection.js, line 12

Extends

Methods

# assertAdminRoleForMethod(userId)

Asserts that the userID belongs to an admin role when running the find and removeUser method within this class.

Parameters:
Name Type Description
userId String

The userId of the logged in user.

View Source api/user/UserInteractionCollection.js, line 57

# 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.js, line 168

If not defined.

Meteor.Error

# count() → {Number}

Returns the number of documents in this collection.

Overrides:

View Source api/base/BaseCollection.js, line 35

The number of elements in this collection.

Number

# define(username, type, typeData, timestamp) → {String}

Defines a user interaction.

Parameters:
Name Type Description
username String

the user.

type String

the type of interaction.

typeData Array.<String>

additional information about the interaction.

timestamp Date

the time of the interaction.

Overrides:

View Source api/user/UserInteractionCollection.js, line 30

the ID of the user interaction.

String

# 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.js, line 201

An object representing the contents of this collection.

Object

# dumpOne(docID) → {Object}

Returns an object representing the definition of docID in a format appropriate to the restoreOne function. Must be overridden by each collection.

Parameters:
Name Type Description
docID String

A docID from this collection.

Overrides:

View Source api/base/BaseCollection.js, line 222

An object representing this document.

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.js, line 75

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.js, line 86

If the document cannot be found.

Meteor.Error

The document associated with name.

Object

# 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.js, line 111

Mongo.Cursor

# getCollectionName() → {string}

Returns the collection name.

Overrides:

View Source api/base/BaseCollection.js, line 136

The collection name as a string.

string

# getPublicationName() → {String}

Return the publication name.

Overrides:

View Source api/base/BaseCollection.js, line 128

The publication name, as a string.

String

# getSchema() → {SimpleSchema}

Returns the schema attached to this collection.

Overrides:

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

SimpleSchema

# getType() → {String}

Return the type of this collection.

Overrides:

View Source api/base/BaseCollection.js, line 120

The type, as a string.

String

# 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.js, line 153

True if name exists in this collection.

boolean

# publish()

Default publication method for entities. It publishes the entire collection. This should be overridden in subclasses.

Overrides:

View Source api/base/BaseCollection.js, line 178

# 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.js, line 61

# removeUser(username)

Removes all interactions for the given username.

Parameters:
Name Type Description
username String

the user's name to remove.

View Source api/user/UserInteractionCollection.js, line 42

# 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.js, line 243

# 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.js, line 232

The docID of the newly created document.

String

# subscribe()

Default subscription method for entities. It subscribes to the entire collection. Should be overridden in subclass

Overrides:

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

# update(selector, modifier)

Runs a simplified version of update on this collection. This method must be overriden in subclasses.

Parameters:
Name Type Description
selector Object

A MongoDB selector.

modifier Object

A MongoDB modifier

Overrides:
See:

View Source api/base/BaseCollection.js, line 53