Safe Haskell | Unsafe |
---|
- insert :: Insert l p s doc => CollectionName -> doc -> Action l p s (Value l)
- insert_ :: Insert l p s doc => CollectionName -> doc -> Action l p s ()
- insertP :: Insert l p s doc => p -> CollectionName -> doc -> Action l p s (Value l)
- insertP_ :: Insert l p s doc => p -> CollectionName -> doc -> Action l p s ()
- save :: Insert l p s doc => CollectionName -> doc -> Action l p s ()
- saveP :: Insert l p s doc => p -> CollectionName -> doc -> Action l p s ()
- deleteOne :: (LabelState l p s, Serialize l) => Selection l -> Action l p s ()
- deleteOneP :: (LabelState l p s, Serialize l) => p -> Selection l -> Action l p s ()
- find :: (Serialize l, LabelState l p s) => Query l -> Action l p s (Cursor l)
- findP :: (Serialize l, LabelState l p s) => p -> Query l -> Action l p s (Cursor l)
- findOne :: (LabelState l p s, Serialize l) => Query l -> Action l p s (Maybe (LabeledDocument l))
- findOneP :: (LabelState l p s, Serialize l) => p -> Query l -> Action l p s (Maybe (LabeledDocument l))
- next :: (LabelState l p s, Serialize l) => Cursor l -> Action l p s (Maybe (LabeledDocument l))
- nextP :: (LabelState l p s, Serialize l) => p -> Cursor l -> Action l p s (Maybe (LabeledDocument l))
- data Query l = Query {}
- data Selection l = Selection {
- selector :: Selector l
- coll :: CollectionName
- type Selector l = Document l
- select :: (Select selectionOrQuery, Label l) => Selector l -> CollectionName -> selectionOrQuery l
Documentation
insert :: Insert l p s doc => CollectionName -> doc -> Action l p s (Value l)Source
Insert document into collection and return its _id
value,
which is created automatically if not supplied. It is required that
the current label flow to the label of the collection and database
(and vice versa). Additionally, the document must be well-formed
with respect to the collection policy. In other words, all the
labeled values must be below the collection clearance and the
policy be applied successfully.
insert_ :: Insert l p s doc => CollectionName -> doc -> Action l p s ()Source
Same as insert
except it does not return _id
insertP :: Insert l p s doc => p -> CollectionName -> doc -> Action l p s (Value l)Source
Same as insert
, but uses privileges when applying the
collection policies, and doing label comparisons.
insertP_ :: Insert l p s doc => p -> CollectionName -> doc -> Action l p s ()Source
Same as insertP
except it does not return _id
save :: Insert l p s doc => CollectionName -> doc -> Action l p s ()Source
Update a document based on the _id
value. The IFC requirements
subsume those of insert
. Specifically, in addition to being able
to apply all the policies and requiring that the current label flow
to the label of the collection and database save
requires that
the current label flow to the label of the existing database record.
saveP :: Insert l p s doc => p -> CollectionName -> doc -> Action l p s ()Source
Like save
, but uses privileges when performing label
comparisons.
deleteOne :: (LabelState l p s, Serialize l) => Selection l -> Action l p s ()Source
Given a query, delete first object in selection. In addition to being able to read the object, write to the database and collection, it must be that the current label flow to the label of the existing document.
deleteOneP :: (LabelState l p s, Serialize l) => p -> Selection l -> Action l p s ()Source
Same as deleteOne
, but uses privileges when performing label
comparisons.
Finding objects
findP :: (Serialize l, LabelState l p s) => p -> Query l -> Action l p s (Cursor l)Source
Same as find
, but uses privileges when raising the current
label
findOne :: (LabelState l p s, Serialize l) => Query l -> Action l p s (Maybe (LabeledDocument l))Source
Fetch the first document satisfying query, or Nothing
if not
documents matched the query.
findOneP :: (LabelState l p s, Serialize l) => p -> Query l -> Action l p s (Maybe (LabeledDocument l))Source
Same as findOne
, but uses privileges when performing label
comparisons.
next :: (LabelState l p s, Serialize l) => Cursor l -> Action l p s (Maybe (LabeledDocument l))Source
Return next document in query result, or Nothing
if finished.
The current label is raised to join of the current label and
Cursor
label. The document is labeled according to the
underlying 'Collection'\'s policies.
nextP :: (LabelState l p s, Serialize l) => p -> Cursor l -> Action l p s (Maybe (LabeledDocument l))Source
Same as next
, but usess privileges raising the current label.
Use select to create a basic query with defaults, then modify if
desired. Example: (select sel col) {limit =: 10}
. Note that unlike
MongoDB's query functionality, our queries do not allow for
projections (since policies may need a field that is not projects).
Both the selection and sorting are restricted to searchable fields.
TODO: add snapshot.
Query | |
|
Select Query |
Selects documents in specified collection that match the selector.
Selection | |
|
Select Selection |
select :: (Select selectionOrQuery, Label l) => Selector l -> CollectionName -> selectionOrQuery lSource