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
569701db
Commit
569701db
authored
Aug 02, 2016
by
James Cropcho
Committed by
GitHub
Aug 02, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #126 from tggreene/refactor/get-collection
Refactor collection reference
parents
20412a16
ac64af87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
variety.js
variety.js
+5
-5
No files found.
variety.js
View file @
569701db
...
@@ -59,7 +59,7 @@ Released by Maypop Inc, © 2012-2016, under the MIT License. */
...
@@ -59,7 +59,7 @@ Released by Maypop Inc, © 2012-2016, under the MIT License. */
'Please see https://github.com/variety/variety for details.'
;
'Please see https://github.com/variety/variety for details.'
;
}
}
if
(
db
[
collection
]
.
count
()
===
0
)
{
if
(
db
.
getCollection
(
collection
)
.
count
()
===
0
)
{
throw
'The collection specified ('
+
collection
+
') in the database specified ('
+
db
+
') does not exist or is empty.
\
n'
+
throw
'The collection specified ('
+
collection
+
') in the database specified ('
+
db
+
') does not exist or is empty.
\
n'
+
'Possible collection options for database specified: '
+
collNames
+
'.'
;
'Possible collection options for database specified: '
+
collNames
+
'.'
;
}
}
...
@@ -73,7 +73,7 @@ Released by Maypop Inc, © 2012-2016, under the MIT License. */
...
@@ -73,7 +73,7 @@ Released by Maypop Inc, © 2012-2016, under the MIT License. */
};
};
read
(
'collection'
,
null
);
read
(
'collection'
,
null
);
read
(
'query'
,
{});
read
(
'query'
,
{});
read
(
'limit'
,
db
[
config
.
collection
]
.
find
(
config
.
query
).
count
());
read
(
'limit'
,
db
.
getCollection
(
config
.
collection
)
.
find
(
config
.
query
).
count
());
read
(
'maxDepth'
,
99
);
read
(
'maxDepth'
,
99
);
read
(
'sort'
,
{
_id
:
-
1
});
read
(
'sort'
,
{
_id
:
-
1
});
read
(
'outputFormat'
,
'ascii'
);
read
(
'outputFormat'
,
'ascii'
);
...
@@ -311,7 +311,7 @@ Released by Maypop Inc, © 2012-2016, under the MIT License. */
...
@@ -311,7 +311,7 @@ Released by Maypop Inc, © 2012-2016, under the MIT License. */
return
result
;
return
result
;
};
};
var
cursor
=
db
[
config
.
collection
]
.
find
(
config
.
query
).
sort
(
config
.
sort
).
limit
(
config
.
limit
);
var
cursor
=
db
.
getCollection
(
config
.
collection
)
.
find
(
config
.
query
).
sort
(
config
.
sort
).
limit
(
config
.
limit
);
var
interimResults
=
cursor
.
reduce
(
reduceDocuments
,
{});
var
interimResults
=
cursor
.
reduce
(
reduceDocuments
,
{});
var
varietyResults
=
convertResults
(
interimResults
,
cursor
.
size
())
var
varietyResults
=
convertResults
(
interimResults
,
cursor
.
size
())
.
filter
(
filter
)
.
filter
(
filter
)
...
@@ -335,8 +335,8 @@ Released by Maypop Inc, © 2012-2016, under the MIT License. */
...
@@ -335,8 +335,8 @@ Released by Maypop Inc, © 2012-2016, under the MIT License. */
// replace results collection
// replace results collection
log
(
'replacing results collection: '
+
resultsCollectionName
);
log
(
'replacing results collection: '
+
resultsCollectionName
);
resultsDB
[
resultsCollectionName
]
.
drop
();
resultsDB
.
getCollection
(
resultsCollectionName
)
.
drop
();
resultsDB
[
resultsCollectionName
]
.
insert
(
varietyResults
);
resultsDB
.
getCollection
(
resultsCollectionName
)
.
insert
(
varietyResults
);
}
}
var
createAsciiTable
=
function
(
results
)
{
var
createAsciiTable
=
function
(
results
)
{
...
...
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