Skip to content

Commit 1a9b23b

Browse files
authored
Increament the current location index after sending out any value. (#155)
1 parent 0f2ad5e commit 1a9b23b

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/ExtUtil.actor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ ACTOR Future<Void> getArrayStream(Reference<IReadWriteContext> document,
440440
p.send(DataValue(bson::BSONArray(bobs[0].build().getOwned())));
441441
else
442442
p.send(DataValue(bobs[0].build().getOwned()));
443+
currentLoc++;
443444
}
444445

445446
for (; currentLoc < n; ++currentLoc) {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/python
2+
#
3+
# test_update.py
4+
#
5+
# This source file is part of the FoundationDB open source project
6+
#
7+
# Copyright 2013-2019 Apple Inc. and the FoundationDB project authors
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License");
10+
# you may not use this file except in compliance with the License.
11+
# You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS,
17+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
# See the License for the specific language governing permissions and
19+
# limitations under the License.
20+
#
21+
# MongoDB is a registered trademark of MongoDB, Inc.
22+
#
23+
24+
from collections import OrderedDict
25+
import pytest
26+
27+
def test_addToSet_with_none_value(fixture_collection):
28+
collection = fixture_collection
29+
30+
collection.insert_one({'_id':1, "B":[{'a':1}]})
31+
32+
collection.update_one({'_id':1}, {'$addToSet': {'B': None}})
33+
34+
updatedDoc = [i for i in collection.find( {'_id':1})][0]
35+
assert updatedDoc['B'] == [{'a':1}, None], "Expect field 'B' contains the None but got {}".format(updatedDoc)
36+
37+

0 commit comments

Comments
 (0)