CSALDatabase Members

CSAL Mongo

CSALDatabase Members CSAL Mongo Access Library
The CSALDatabase type exposes the following members.
Constructors

  NameDescription
Public methodCSALDatabase
To construct an instance of this class, you supply a valid MongoDB url that includes a database name (e.g. mongodb://localhost:27017/testdb)
Back to Top
Methods

  NameDescription
Public methodOnlineEquals
Determines whether the specified OnlineObject is equal to the current OnlineObject.
(Inherited from OnlineObject.)
Public methodFindClass
Return a single class by ID (or null if not found)
Public methodFindClasses
Return all classes in DB
Public methodFindLesson
Return a single lesson by ID (or null if not found)
Public methodFindLessonAnswerTots
Return a dictionary of Lesson ID => (CorrectCount, IncorrectCount) for all lessons across all students enroller
Public methodFindLessonNames
Return a dictionary of Lesson ID => Lesson Short Names - note that lessons represent human-created content, so this should be a fairly low-effort method
Public methodFindLessons
Return all lessons in DB
Public methodFindStudent
Return a single student by ID (or null if not found)
Public methodFindStudents
Return all students in DB
Public methodFindStudentsByLocation
Return a list of students that are at the given location
Public methodFindTurns
Return all turns matching the given lesson and student. Note that a null or empty string result in no filter.
Public methodFindTurnsForStudents
Return all StudentLessonActs instances that match any of the students given
Public methodFindTurnsRaw
Exactly like FindTurns, but returns the raw BsonDocument representation of the data. Since we are very liberal in what we accept in SaveRawStudentActLesson, we might have turn data that causes exceptions when interpreted with our Model
Public methodFindTurnSummary
Really only for dev view - return a tuple for each StudentLessonActs instance defined as (LessonID, UserID, TurnCount)
Public methodOnlineGetHashCode
Serves as a hash function for a particular type.
(Inherited from OnlineObject.)
Public methodOnlineGetType
Gets the OnlineType of the current instance.
(Inherited from OnlineObject.)
Public methodInsureIndexes
This very hacky function manually insures all indexes that we want in the MongoDB collections that we manage. Should really only be called once in a blue moon. Currently called on app startup by our web api app.
Public methodSaveClass
Given a class (of students, not an ADT), save it to the database
Public methodSaveLesson
Given a single lesson, save it to the database
Public methodSaveRawStudentLessonAct
Accept a raw JSON data record describing a single CSAL student/lesson interaction. The JSON record is expected to be in the format described in the document "CSAL Data". Note that in practice just about any record format will be saved in an effort to preserve as much data as possible in the event of a system bug. HOWEVER, the top-level fields LessonID and UserID MUST be present
Public methodSaveStudent
Given a student instance, save to the database
Public methodSaveStudentReadingTarget
Like our "main" function SaveRawStudentLessonAct, it should be a JSON object with two fields: UserID and TargetURL.
Public methodOnlineToString
Returns a string that represents the current object.
(Inherited from OnlineObject.)
Back to Top
Fields

  NameDescription
Public fieldStatic memberCLASS_COLLECTION
MongoDB collection name for classes
Public fieldStatic memberLESSON_COLLECTION
MongoDB collection name for lessons
Public fieldStatic memberSTUDENT_ACT_COLLECTION
MongoDB collection name for turns (actions) tracked for students/lessons
Public fieldStatic memberSTUDENT_COLLECTION
MongoDB collection name for students
Back to Top
Properties

  NameDescription
Public propertyServerURL
MongoDB URL specifying MongoDB database to target. Note that you should specify a database in URL (although it is technically optional in the MongoDB spec)
Back to Top
See Also