Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Foundation
Security
scripts
Merge requests
!13
Adding local query to list all documents with branch protection
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Adding local query to list all documents with branch protection
adding_local_query_to_list_documents_with_branch_protection
into
main
Overview
0
Commits
1
Changes
2
Merged
Francisco Perez
requested to merge
adding_local_query_to_list_documents_with_branch_protection
into
main
1 year ago
Overview
0
Commits
1
Changes
2
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
000f38ee
1 commit,
1 year ago
2 files
+
62
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
otterdog_database/doc/mongdb_queries/local/documents_list_with_default_branch_and_branch_protection.js
0 → 100644
+
61
−
0
Options
db
.
getCollection
(
"
organizations
"
).
aggregate
([{
$project
:{
_id
:
0
,
github_id
:
1
,
repositories
:
{
$map
:{
input
:
"
$repositories
"
,
as
:
"
repo
"
,
in
:
{
repo_name
:
"
$$repo.name
"
,
repo_default_branch
:
"
$$repo.default_branch
"
,
branch_protection_rules
:
"
$$repo.branch_protection_rules
"
,
}
}
},
}
},
{
$unwind
:
"
$repositories
"
},{
$project
:{
_id
:
0
,
github_id
:
1
,
repo_name
:
"
$repositories.repo_name
"
,
repo_default_branch
:
"
$repositories.repo_default_branch
"
,
repo_branch_protection_rules
:
"
$repositories.branch_protection_rules
"
,
}
},
{
$sort
:
{
total_repo_branch_protection_rules
:
-
1
}
},
{
$project
:
{
_id
:
0
,
github_id
:
1
,
repo_name
:
1
,
repo_default_branch
:
1
,
repo_branch_protection_rules
:
{
$filter
:
{
input
:
"
$repo_branch_protection_rules
"
,
as
:
"
bpr
"
,
cond
:
{
$eq
:
[
"
$$bpr.pattern
"
,
"
$repo_default_branch
"
]
}
}
}
}
},{
$project
:
{
_id
:
0
,
github_id
:
1
,
repo_name
:
1
,
repo_default_branch
:
1
,
repo_default_branch_protection
:
{
$cond
:
{
if
:
{
$eq
:
[
"
$repo_branch_protection_rules
"
,
[]]},
then
:
"
not protected
"
,
else
:
"
protected
"
}
}
}
}
])
\ No newline at end of file
Loading