Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
variety
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
variety
Commits
6d58bd8e
Commit
6d58bd8e
authored
May 25, 2012
by
Wes Freeman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add occurrence checking for arrays with nested objects.
parent
d025b62d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
variety.js
variety.js
+6
-5
No files found.
variety.js
View file @
6d58bd8e
...
@@ -136,16 +136,17 @@ resultsDB[resultsCollectionName].find({}).forEach(function(key) {
...
@@ -136,16 +136,17 @@ resultsDB[resultsCollectionName].find({}).forEach(function(key) {
return
;
return
;
}
}
if
(
!
(
keyName
.
match
(
/
\.
XX/
)
&&
!
keyName
.
match
(
/
\.
XX$/
)))
{
if
(
keyName
.
match
(
/
\.
XX/
))
{
// i.e. "Unless the key's value is an array which contains arrays" -JC
// exists query checks for embedded values for an array
// ...we do not support totalOccurrences for these keys because it is
// ie. match {arr:[{x:1}]} with {"arr.x":{$exists:true}}
// a bit too tricky for a 'version 1'. Perhaps we'll support in the future. -JC
// just need to pull out .XX in this case
keyName
=
keyName
.
replace
(
/.XX/g
,
""
);
}
var
existsQuery
=
{};
var
existsQuery
=
{};
existsQuery
[
keyName
]
=
{
$exists
:
true
};
existsQuery
[
keyName
]
=
{
$exists
:
true
};
key
.
totalOccurrences
=
db
[
collection
].
count
(
existsQuery
);
key
.
totalOccurrences
=
db
[
collection
].
count
(
existsQuery
);
key
.
percentContaining
=
(
key
.
totalOccurrences
/
numDocuments
)
*
100
;
key
.
percentContaining
=
(
key
.
totalOccurrences
/
numDocuments
)
*
100
;
}
resultsDB
[
resultsCollectionName
].
save
(
key
);
resultsDB
[
resultsCollectionName
].
save
(
key
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment