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
c4a73c55
Commit
c4a73c55
authored
May 25, 2012
by
Wes Freeman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added BinData checking. Removed need for blacklist array of keys by checking for object types.
parent
85f32410
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
16 deletions
+7
-16
variety.js
variety.js
+7
-16
No files found.
variety.js
View file @
c4a73c55
...
@@ -25,7 +25,10 @@ varietyCanHaveChildren = function (v) {
...
@@ -25,7 +25,10 @@ varietyCanHaveChildren = function (v) {
typeof
v
.
length
===
'number'
&&
typeof
v
.
length
===
'number'
&&
!
(
v
.
propertyIsEnumerable
(
'length'
));
!
(
v
.
propertyIsEnumerable
(
'length'
));
var
isObject
=
typeof
v
===
'object'
;
var
isObject
=
typeof
v
===
'object'
;
return
isArray
||
isObject
;
var
specialObject
=
v
instanceof
Date
||
v
instanceof
ObjectId
||
v
instanceof
BinData
;
return
!
specialObject
&&
(
isArray
||
isObject
);
}
}
db
.
system
.
js
.
save
(
{
_id
:
"varietyCanHaveChildren"
,
value
:
varietyCanHaveChildren
}
);
db
.
system
.
js
.
save
(
{
_id
:
"varietyCanHaveChildren"
,
value
:
varietyCanHaveChildren
}
);
...
@@ -63,6 +66,9 @@ varietyTypeOf = function(thing) {
...
@@ -63,6 +66,9 @@ varietyTypeOf = function(thing) {
else
if
(
thing
instanceof
ObjectId
)
{
else
if
(
thing
instanceof
ObjectId
)
{
return
"objectId"
;
return
"objectId"
;
}
}
else
if
(
thing
instanceof
BinData
)
{
return
"binData"
;
}
else
{
else
{
return
"object"
;
return
"object"
;
}
}
...
@@ -115,10 +121,6 @@ var resultsDB = db.getMongo().getDB("varietyResults");
...
@@ -115,10 +121,6 @@ var resultsDB = db.getMongo().getDB("varietyResults");
var
numDocuments
=
db
[
collection
].
count
();
var
numDocuments
=
db
[
collection
].
count
();
// Using our method of retrieving keys, Mongo gets confused about the following, and
// incorrectly thinks they are keys. -JC
var
blackListKeys
=
[
"_id.equals"
,
"_id.getTimestamp"
,
"_id.isObjectId"
,
"_id.str"
,
"_id.tojson"
];
resultsDB
[
resultsCollectionName
].
find
({}).
forEach
(
function
(
key
)
{
resultsDB
[
resultsCollectionName
].
find
({}).
forEach
(
function
(
key
)
{
keyName
=
key
[
"_id"
].
key
;
keyName
=
key
[
"_id"
].
key
;
...
@@ -129,17 +131,6 @@ resultsDB[resultsCollectionName].find({}).forEach(function(key) {
...
@@ -129,17 +131,6 @@ resultsDB[resultsCollectionName].find({}).forEach(function(key) {
return
;
return
;
}
}
var
blackListKeyFound
=
false
;
blackListKeys
.
forEach
(
function
(
blackListKey
)
{
if
(
keyName
===
blackListKey
)
{
resultsDB
[
resultsCollectionName
].
remove
({
"_id"
:
{
key
:
keyName
}});
blackListKeyFound
=
true
;
}
});
if
(
blackListKeyFound
)
{
return
;
}
if
(
!
(
keyName
.
match
(
/
\.
XX/
)
&&
!
keyName
.
match
(
/
\.
XX$/
)))
{
if
(
!
(
keyName
.
match
(
/
\.
XX/
)
&&
!
keyName
.
match
(
/
\.
XX$/
)))
{
// i.e. "Unless the key's value is an array which contains arrays" -JC
// i.e. "Unless the key's value is an array which contains arrays" -JC
// ...we do not support totalOccurrences for these keys because it is
// ...we do not support totalOccurrences for these keys because it is
...
...
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