Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
jio
Commits
5d33de92
Commit
5d33de92
authored
Apr 25, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
querystorage handles partial_query option
parent
6adfec0f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
8 deletions
+33
-8
src/jio.storage/querystorage.js
src/jio.storage/querystorage.js
+33
-8
No files found.
src/jio.storage/querystorage.js
View file @
5d33de92
...
...
@@ -127,6 +127,14 @@
then
(
command
.
success
,
command
.
error
,
command
.
notify
);
};
function
makeUnsupportedOptionsError
(
rejected_options
)
{
throw
{
"
status
"
:
501
,
"
error
"
:
"
UnsupportedOptionError
"
,
"
reason
"
:
"
unsupported option
"
,
"
arguments
"
:
rejected_options
};
}
/**
* Retrieve documents.
...
...
@@ -160,6 +168,9 @@
if
(
supported_options
[
unsupported_option
])
{
reason
[
"
arguments
"
].
splice
(
i
+
offset
,
1
);
offset
-=
1
;
if
({
"
query
"
:
1
}[
unsupported_option
])
{
cloned_options
.
partial_query
=
cloned_options
.
query
;
}
if
({
"
query
"
:
1
,
"
sort_on
"
:
1
}[
unsupported_option
])
{
cloned_options
.
include_docs
=
true
;
delete
cloned_options
.
limit
;
...
...
@@ -170,18 +181,32 @@
delete
cloned_options
[
unsupported_option
];
});
if
(
reason
[
"
arguments
"
].
length
>
0
)
{
throw
{
"
status
"
:
501
,
"
error
"
:
"
UnsupportedOptionError
"
,
"
reason
"
:
"
unspported option
"
,
"
arguments
"
:
reason
[
"
arguments
"
]
};
throw
makeUnsupportedOptionsError
(
reason
[
"
arguments
"
]);
}
return
substorage
.
allDocs
(
cloned_options
).
then
(
null
,
function
(
reason
)
{
if
(
reason
.
error
!==
"
UnsupportedOptionError
"
||
!
Array
.
isArray
(
reason
[
"
arguments
"
])
||
reason
[
"
arguments
"
].
length
===
0
)
{
throw
reason
;
}
var
partial_query_issue
=
true
;
reason
[
"
arguments
"
].
slice
().
forEach
(
function
(
unsupported_option
,
i
)
{
if
(
unsupported_option
!==
"
partial_query
"
)
{
partial_query_issue
=
false
;
}
delete
cloned_options
[
unsupported_option
];
});
if
(
!
partial_query_issue
)
{
throw
makeUnsupportedOptionsError
(
reason
[
"
arguments
"
]);
}
return
substorage
.
allDocs
(
cloned_options
);
});
}).
then
(
function
(
response
)
{
var
data_rows
=
response
.
data
.
rows
,
docs
=
{},
row
,
i
,
l
;
if
(
!
cloned_options
.
include_docs
)
{
if
(
!
cloned_options
.
include_docs
||
!
(
options
.
query
||
options
.
select_list
||
options
.
sort_on
||
options
.
limit
))
{
return
response
;
}
...
...
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