Fight harassment with your squad.
mailiam/SublimeLinter-contrib-swiftlint 3
SublimeLinter plugin for Swift, using swiftlint.
Demo application using the MongoDB Swift driver
A sample todo list application demonstrating MongoMobile for iOS
Advent of Code 2019, in Swift
Advent of Code 2020, in Swift
POC of a pure Swift BSON library implementation
startedelsehow/aaronson-oracle
started time in 5 hours
push eventmongodb/node-mongodb-native
commit sha fe3d11dc41909c0344f2c208ca05de9e675fe3d2
test(NODE-3188): backport transaction pinning tests
push time in a day
push eventmongodb/node-mongodb-native
commit sha be1bfab98facb57b8334d4d37371b9a1b8ace040
test(NODE-3188): backport transaction pinning tests
push time in 2 days
PR opened mongodb/node-mongodb-native
Backport of https://github.com/mongodb/node-mongodb-native/pull/2831
pr created time in 2 days
Pull request review commentmongodb/node-mongodb-native
test(NODE-3188): refactor transaction spec tests:
export class Connection extends TypedEventEmitter<ConnectionEvents> { clusterTime = session.clusterTime; } + // We need to unpin any read or write commands that happen outside of a pinned+ // transaction, so we check if we have a pinned transaction that is no longer+ // active, and unpin for all except start or commit.
Yes, start is not active yet and commit could be any commit after the transaction is already committed, which we test for. (multiple commits are allowed)
comment created time in 2 days
Pull request review commentmongodb/node-mongodb-native
fix(NODE-2035): exceptions thrown from awaited cursor for each do not propagate
describe('Cursor', function () { }); }); + // NODE-2035+ it('should propagate error when exceptions are thrown from an awaited forEach call', function () {+ const configuration = this.configuration;+ const client = configuration.newClient({ w: 1 }, { maxPoolSize: 1 });+ const docs = [{ a: 1 }, { a: 2 }, { a: 3 }];+ let collection;+ let db;+ return client+ .connect()+ .then(() => {+ db = client.db(configuration.db);+ collection = db.collection('cursor_session_tests2');+ return collection.insertMany(docs);+ }, console.error)+ .then(() => {+ const cursor = collection.find({});+ async function testAsync() {+ let promiseResult;+ try {+ promiseResult = await cursor+ .forEach(() => {+ throw new Error('FAILURE IN FOREACH CALL');+ })+ .catch(err => {+ expect(err.message).to.deep.equal('FAILURE IN FOREACH CALL');+ });+ } catch (err) {+ expect(err).to.be.undefined;+ }
Fwiw, it might also be nice here to check that the catch handler is actually called?
comment created time in 2 days
Pull request review commentmongodb/mongo-rust-driver
RUST-310 Use serde for `ClientOptions` tests
impl Default for ClientOptions { } } +impl Serialize for ClientOptions {
Since we're only using this implementation for tests, you should be able to add the tag #[cfg(test)] which will instruct the compiler only to compile this code if the tests are being compiled/run. You'll also need to add this tag to the serialize_with functions you've defined. This can help minimize build time for users who aren't running our tests.
comment created time in 3 days
Pull request review commentmongodb/mongo-rust-driver
RUST-310 Use serde for `ClientOptions` tests
impl WriteConcern { Ok(()) }++ pub(crate) fn serialize_for_client_options<S>(
Ditto above comment: instead of having this extra function we can just define the WriteConcernHelper function directly in the Serialize implementation.
comment created time in 3 days
Pull request review commentmongodb/mongo-rust-driver
RUST-310 Use serde for `ClientOptions` tests
async fn run_test(test_file: TestFile) { let options = ClientOptions::parse(&test_case.uri) .await .expect(&test_case.description);- let mut options_doc = document_from_client_options(options);+ let mut options_doc = bson::to_document(&options).expect(&test_case.description);
Can you add a descriptive message in the call to expect in addition to the test case description? Otherwise it can be a bit tricky to figure out why the test failed.
comment created time in 3 days
Pull request review commentmongodb/mongo-rust-driver
RUST-310 Use serde for `ClientOptions` tests
impl Default for ClientOptions { } } +impl Serialize for ClientOptions {+ fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>+ where+ S: Serializer,+ {+ #[derive(Serialize)]+ struct ClientOptionsHelper<'a> {
Why is the lifetime needed here?
comment created time in 3 days
Pull request review commentmongodb/mongo-rust-driver
RUST-310 Use serde for `ClientOptions` tests
impl ReadConcern { pub fn custom(level: String) -> Self { ReadConcernLevel::from_str(level.as_str()).into() }++ pub(crate) fn serialize_for_client_options<S>(
Since it seems like the only custom functionality here is to rename the level field, another way we could do this is by making a dummy struct within the Serialize implementation for ClientOptions with a readconcernlevel field:
struct ReadConcernHelper {
readconcernlevel: ReadConcernLevel,
}
We could then use this struct in the ClientOptionsHelper struct instead of ReadConcern. That would require a little less customization -- what do you think?
Unfortunately this seems to be a situation in which serde is not as flexible as usual; I was looking into the various attributes to see if there was a good workaround using rename or alias but serialization naming is harder to customize than deserialization naming.
comment created time in 3 days
Pull request review commentmongodb/mongo-rust-driver
RUST-310 Use serde for `ClientOptions` tests
pub(crate) fn serialize_duration_as_int_millis<S: Serializer>( } } +pub(crate) fn serialize_duration_as_secs<S: Serializer>(
can you update this name to indicate that it's an Option<Duration>?
comment created time in 3 days
Pull request review commentmongodb/mongo-rust-driver
RUST-310 Use serde for `ClientOptions` tests
impl From<TlsOptions> for Option<Tls> { } } +impl Tls {+ pub(crate) fn serialize_for_client_options<S>(+ tls: &Option<Tls>,+ serializer: S,+ ) -> std::result::Result<S::Ok, S::Error>+ where+ S: Serializer,+ {+ match tls {+ Some(Tls::Enabled(tls_options)) => {+ TlsOptions::serialize_for_client_options(tls_options, serializer)+ }+ _ => serializer.serialize_none(),
small style nit: it's a bit more readable to use None here rather than the wildcard pattern
comment created time in 3 days
Pull request review commentmongodb/node-mongodb-native
fix(NODE-2035): exceptions thrown from awaited cursor for each do not propagate
describe('Cursor', function () { }); }); + // NODE-2035+ it('should propagate error when exceptions are thrown from an awaited forEach call', function () {+ const configuration = this.configuration;+ const client = configuration.newClient({ w: 1 }, { maxPoolSize: 1 });+ const docs = [{ a: 1 }, { a: 2 }, { a: 3 }];+ let collection;+ let db;+ return client+ .connect()+ .then(() => {+ db = client.db(configuration.db);+ collection = db.collection('cursor_session_tests2');+ return collection.insertMany(docs);+ }, console.error)+ .then(() => {+ const cursor = collection.find({});+ async function testAsync() {+ let promiseResult;+ try {+ promiseResult = await cursor+ .forEach(() => {+ throw new Error('FAILURE IN FOREACH CALL');+ })+ .catch(err => {+ expect(err.message).to.deep.equal('FAILURE IN FOREACH CALL');+ });+ } catch (err) {+ expect(err).to.be.undefined;+ }+ expect(promiseResult).to.be.undefined;+ cursor.close();+ client.close();
If the suggested change above is made make sure you still return the client.close() promise.
comment created time in 3 days
Pull request review commentmongodb/node-mongodb-native
fix(NODE-2035): exceptions thrown from awaited cursor for each do not propagate
export abstract class AbstractCursor< next<T>(this, true, (err, doc) => { if (err || doc == null) return done(err); if (doc == null) return done();-+ let result; // NOTE: no need to transform because `next` will do this automatically- let result = iterator(doc); // TODO(NODE-3283): Improve transform typing+ try {+ result = iterator(doc); // TODO(NODE-3283): Improve transform typing+ } catch (e) {
nit: prefer using error for the variable name here
comment created time in 3 days
Pull request review commentmongodb/node-mongodb-native
fix(NODE-2035): exceptions thrown from awaited cursor for each do not propagate
describe('Cursor', function () { }); }); + // NODE-2035+ it('should propagate error when exceptions are thrown from an awaited forEach call', function () {+ const configuration = this.configuration;+ const client = configuration.newClient({ w: 1 }, { maxPoolSize: 1 });+ const docs = [{ a: 1 }, { a: 2 }, { a: 3 }];+ let collection;+ let db;+ return client+ .connect()+ .then(() => {+ db = client.db(configuration.db);+ collection = db.collection('cursor_session_tests2');+ return collection.insertMany(docs);+ }, console.error)+ .then(() => {+ const cursor = collection.find({});+ async function testAsync() {+ let promiseResult;+ try {+ promiseResult = await cursor+ .forEach(() => {+ throw new Error('FAILURE IN FOREACH CALL');+ })+ .catch(err => {+ expect(err.message).to.deep.equal('FAILURE IN FOREACH CALL');+ });+ } catch (err) {+ expect(err).to.be.undefined;+ }
const cursor = collection.find({});
expect(() => {
cursor
.forEach(() => {
throw new Error('FAILURE IN FOREACH CALL');
})
.catch(err => {
expect(err.message).to.deep.equal('FAILURE IN FOREACH CALL');
});
}).to.not.throw();
We can reduce some of the logic here, if we pass a function to chai with expect(...).to.not.throw(); then we can confirm that the forEach doesn't throw synchronously and still check that the error is correctly propagated to the catch callback. (ie. its part of the promise chain).
comment created time in 3 days
Pull request review commentmongodb/node-mongodb-native
fix(NODE-2035): exceptions thrown from awaited cursor for each do not propagate
export abstract class AbstractCursor< next<T>(this, true, (err, doc) => { if (err || doc == null) return done(err); if (doc == null) return done();-+ let result; // NOTE: no need to transform because `next` will do this automatically- let result = iterator(doc); // TODO(NODE-3283): Improve transform typing+ try {+ result = iterator(doc); // TODO(NODE-3283): Improve transform typing+ } catch (e) {+ return done(e);+ }+ if (result === false) return done(); // these do need to be transformed since they are copying the rest of the batch const internalDocs = this[kDocuments].splice(0, this[kDocuments].length); if (internalDocs) { for (let i = 0; i < internalDocs.length; ++i) {- result = iterator(- (transform ? transform(internalDocs[i]) : internalDocs[i]) as T // TODO(NODE-3283): Improve transform typing- );+ try {+ result = iterator(+ (transform ? transform(internalDocs[i]) : internalDocs[i]) as T // TODO(NODE-3283): Improve transform typing+ );+ } catch (e) {
nit: prefer using error for the variable name here
comment created time in 3 days
PR opened mongodb/node-mongodb-native
Description
NODE-3288
See also: #2837
pr created time in 3 days
create barnchmongodb/node-mongodb-native
branch : NODE-3288/3.6/add-test-for-security-sensitive-event-redaction
created branch time in 3 days
push eventmongodb/node-mongodb-native
push time in 3 days
push eventmongodb/mongo-rust-driver
commit sha 53bd873a8a5c0587719a362aefb1d93a0f2b1d0f
RUST-820 Test against 5.0 servers (#360)
push time in 3 days
PR opened mongodb/node-mongodb-native
Description
NODE-3288
pr created time in 3 days
startedSwiftUIX/Coordinator
started time in 3 days
push eventmongodb/node-mongodb-native
commit sha 9608c6a46cea0ec536debd47492fe4007391d6fa
refactor(NODE-3291)!: Standardize error representation in the driver (#2824)
commit sha 28533dadb43d0130382a6be02f90c337a9adc297
refactor: rename apm spec directory to command-monitoring
commit sha c301c1e34b7bc3a88667fbdd5fdbae3acf88c154
Sync redacted commands spec tests
commit sha 980f167612442f3293c5a8b85026aa34b3416a0a
Skip failing spec tests
commit sha da577c34a8da60b85040687a31232ee052d44262
Move legacy command-monitoring spec tests into their own folder
push time in 3 days
create barnchmongodb/node-mongodb-native
branch : NODE-3288/add-test-for-security-sensitive-event-redaction
created branch time in 3 days
push eventmongodb/node-mongodb-native
commit sha 5a6279ac436fd37158d98f80b302e1affac4a406
test(NODE-3284): add maxPoolSize=0 spec tests (#2830)
commit sha 0d91da1b1388e6946ec991fee82f92647a199ece
feat(NODE-3333): support 'let' option for CRUD commands (#2829)
commit sha 9608c6a46cea0ec536debd47492fe4007391d6fa
refactor(NODE-3291)!: Standardize error representation in the driver (#2824)
commit sha e5d43667cb539de5975bbdf70413eb7e7399f28d
stared fix for NODE-1502
commit sha 5addcc6cede1954e7dfe1a2baf9be5aafe5b8d31
finished NODE-1502
commit sha 103b3d5d4e3c1eaabbeb97e53bedd302f8bd0829
Fixed formatting
commit sha 88f30b455b6b7a92012c61b4a909739484f70b1a
Changed scope of clonedCommand variable
commit sha 61328bf4139daa43fca09f56f81aa5db31e7133f
Added test to ensure that copying commands for command monitoring works as expected
commit sha c950d95a0392c919205ad320e2188317a9f6273a
Made deep copies of command fields when extracting commands in src/cmap/command_monitoring_events.ts
commit sha 8164edd1da8c6ac1ba9dbf07031b41c6a2c2c994
Reverted changes to src/cmap/connection.ts
commit sha 85eb06af9628a83fa8179e4ea20798eaa160a78b
Made test for NODE-1502 account for nested documents
commit sha 0761b5ee5c27a19e1ab74019c766fcb30ce0000b
Added test metadata to ensure test only runs on mongodb versions >=3.6.0
commit sha 2a332180bab7c55da5c8ac9cb39821cc8102fe17
fixed bug extractCommand in src/cmap/command_monitoring_events.ts
commit sha dcdecb12028d1ebf66c8f8bf93a5841203e0b173
Removed unused import
commit sha 59a3e7335244863860c551894ff7c1fb5e9c91a8
Resolved review comments
commit sha a124325aa77a9983c83d78fdeda71fb225dee5cc
Cleaning up after test
commit sha 4560e9d581e66b0ea3056b21ecf3ba757e56807e
Added unit test to ensure the CommandStartedEvents do not hold references to commands passed into the constructor
commit sha 7fe88189add0b35ee036ba742d0f85f2623323b4
fix: removed unneeded boilerplate from test
commit sha b6c58ae35c5bba0568e8a83d45235ebe4678f4c4
fix: removed done callback and changed forEach to for of loop
commit sha 1616ec299d808fdbed5a53b81d796b3ba53f72dd
Merge branch 'NODE-1502/4.0/Command-monitoring-commands-should-be-copies' of github.com:mongodb/node-mongodb-native into NODE-1502/4.0/Command-monitoring-commands-should-be-copies
push time in 3 days
PR opened mongodb/mongo-rust-driver
Pretty straightforward! If we want to add any other tests to this we should probably add them manually here.
I also think it could be helpful to add this script into a pre-commit hook, but that's probably another discussion.
pr created time in 3 days
pull request commentmongodb/mongo-rust-driver
RUST-790 Rename ServerApiVersion::Version1 to ::V1
Code changes looks good, looks like there's a formatting issue in CI -- can you run the formatting script?
Fixed!
comment created time in 3 days