Skip to content

Commit

Permalink
Upgrade to a newer baas version
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed Nov 27, 2023
1 parent 6895655 commit b387972
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
9 changes: 2 additions & 7 deletions Realm/ObjectServerTests/RLMFlexibleSyncServerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,13 @@ - (void)testFlexibleSyncAddObjectOutsideQuery {
auto ex = [self expectationWithDescription:@"should revert write"];
self.flexibleSyncApp.syncManager.errorHandler = ^(NSError *error, RLMSyncSession *) {
RLMValidateError(error, RLMSyncErrorDomain, RLMSyncErrorWriteRejected,
@"Client attempted a write that is outside of permissions or query filters; it has been reverted");
@"Client attempted a write that is not allowed; it has been reverted");
NSArray<RLMCompensatingWriteInfo *> *info = error.userInfo[RLMCompensatingWriteInfoKey];
XCTAssertEqual(info.count, 1U);
XCTAssertEqualObjects(info[0].objectType, @"Person");
XCTAssertEqualObjects(info[0].primaryKey, invalidObjectPK);
XCTAssertEqualObjects(info[0].reason,
([NSString stringWithFormat:@"write to \"%@\" in table \"Person\" not allowed; object is outside of the current query view", invalidObjectPK]));
([NSString stringWithFormat:@"write to ObjectID(\"%@\") in table \"Person\" not allowed; object is outside of the current query view", invalidObjectPK]));
[ex fulfill];
};
[realm transactionWithBlock:^{
Expand Down Expand Up @@ -1048,11 +1048,6 @@ - (void)testFlexibleSyncInitialSubscriptionRerunOnOpen {
XCTAssertNotNil(realm);
XCTAssertNil(error);
XCTAssertEqual(realm.subscriptions.count, 1UL);
// Adding this sleep, because there seems to be a timing issue after this commit in baas
// https://github.com/10gen/baas/commit/64e75b3f1fe8a6f8704d1597de60f9dda401ccce,
// data take a little longer to be downloaded to the realm even though the
// sync client changed the subscription state to completed.
sleep(1);
CHECK_COUNT(11, Person, realm);
[ex fulfill];
}];
Expand Down
2 changes: 1 addition & 1 deletion Realm/ObjectServerTests/setup_baas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}.to_h

MONGODB_VERSION='5.0.6'
GO_VERSION='1.19.5'
GO_VERSION='1.21.4'
NODE_VERSION='16.13.1'
STITCH_VERSION=DEPENDENCIES["STITCH_VERSION"]

Expand Down
12 changes: 8 additions & 4 deletions Realm/RLMMongoCollection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,17 @@ - (void)aggregateWithPipeline:(NSArray<NSDictionary<NSString *, id<RLMBSON>> *>
- (void)countWhere:(NSDictionary<NSString *, id<RLMBSON>> *)document
limit:(NSInteger)limit
completion:(RLMMongoCountBlock)completion {
self.collection.count(toBsonDocument(document), limit,
[completion](uint64_t count,
std::optional<realm::app::AppError> error) {
self.collection.count_bson(toBsonDocument(document), limit,
[completion](std::optional<realm::bson::Bson>&& value,
std::optional<realm::app::AppError>&& error) {
if (error) {
return completion(0, makeError(*error));
}
completion(static_cast<NSInteger>(count), nil);
if (value->type() == realm::bson::Bson::Type::Int64) {
return completion(static_cast<NSInteger>(static_cast<int64_t>(*value)), nil);
}
// If the collection does not exist the call returns undefined
return completion(0, nil);
});
}

Expand Down
2 changes: 1 addition & 1 deletion dependencies.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION=10.44.0
REALM_CORE_VERSION=13.24.0
STITCH_VERSION=911b8db03b852f664af13880c42eb8178d4fb5f4
STITCH_VERSION=27f42f55a7944ed7d8ba9fad1854a4b22714cb8d

0 comments on commit b387972

Please sign in to comment.