You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my MongoDB cluster, I have a database userDB with the collection users. This userDB.users collection has a property status which can either have the value active or deleted.
I have also created a mongodb viewusers.notDeleted. This read-only view performs a simple $match aggregation on users to just provide all users that have not been
marked as deleted.
MongoDB Compass sidebar indicating the structure of DB, view, and collection
An excerpt of the users validation schema showing the possible values of the status field
The very simple $match aggregation that is used to create the users.notDeleted view
The test in question
I want to write a unit test for my code that validates a user. A user is created via insertion into the users collection, but you can only login to users that are found in the users.notDeleted view.
Currently I can just mock users.notDeleted, but I am wondering if it can be possible to set up the view in the test environment?
The text was updated successfully, but these errors were encountered:
Context
In my MongoDB cluster, I have a database
userDB
with the collectionusers
. ThisuserDB.users
collection has a propertystatus
which can either have the valueactive
ordeleted
.I have also created a mongodb view
users.notDeleted
. This read-only view performs a simple$match
aggregation onusers
to just provide all users that have not beenmarked as
deleted
.MongoDB Compass sidebar indicating the structure of DB, view, and collection
An excerpt of the
users
validation schema showing the possible values of thestatus
fieldThe very simple
$match
aggregation that is used to create theusers.notDeleted
viewThe test in question
I want to write a unit test for my code that validates a user. A user is created via insertion into the
users
collection, but you can only login to users that are found in theusers.notDeleted
view.Currently I can just mock
users.notDeleted
, but I am wondering if it can be possible to set up the view in the test environment?The text was updated successfully, but these errors were encountered: