Skip to content
This repository was archived by the owner on Apr 20, 2020. It is now read-only.

Commit bd64266

Browse files
committed
Merge branch 'mget' of github.com:RedisLabsModules/RedisDoc into del_replace
2 parents 089274d + e0f1555 commit bd64266

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/lib.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,17 @@ fn json_get(ctx: &Context, args: Vec<String>) -> RedisResult {
102102

103103
fn json_mget(ctx: &Context, args: Vec<String>) -> RedisResult {
104104

105-
if args.len() < 2 {
105+
if args.len() < 3 {
106106
return Err(RedisError::WrongArity);
107107
}
108108
if let Some(path) = args.last() {
109109
let mut path = path.clone();
110110
if path.starts_with(".") { // backward compatibility
111111
path.insert(0, '$');
112112
}
113-
let keys_len = args.len()-2;
114-
let mut args_iter = args.into_iter().skip(1);
115-
let mut results: Vec<String> = Vec::with_capacity(keys_len);
116-
for _i in 0..keys_len {
117-
let key = args_iter.next_string()?;
118-
113+
let mut results: Vec<String> = Vec::with_capacity(args.len()-2);
114+
for key in &args[1..args.len()-1] {
119115
let redis_key = ctx.open_key_writable(&key);
120-
121116
match redis_key.get_value::<RedisJSON>(&REDIS_JSON_TYPE)? {
122117
Some(doc) => {
123118
let result = doc.to_string(&path)?;

0 commit comments

Comments
 (0)