profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/kmahar/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Kaitlin Mahar kmahar @mongodb Brooklyn, NY kaitlin.dev lead engineer @mongodb, @swift-server workgroup member

amyxzhang/squadbox 20

Fight harassment with your squad.

mailiam/SublimeLinter-contrib-swiftlint 3

SublimeLinter plugin for Swift, using swiftlint.

kmahar/swift-driver-demo 1

Demo application using the MongoDB Swift driver

10gen/TestMongoMobile 0

A sample todo list application demonstrating MongoMobile for iOS

kmahar/aoc-2019 0

Advent of Code 2019, in Swift

kmahar/aoc-2020 0

Advent of Code 2020, in Swift

kmahar/BSON 0

POC of a pure Swift BSON library implementation

startedelsehow/aaronson-oracle

started time in 5 hours

push eventmongodb/node-mongodb-native

Durran Jordan

commit sha fe3d11dc41909c0344f2c208ca05de9e675fe3d2

test(NODE-3188): backport transaction pinning tests

view details

push time in a day

push eventmongodb/node-mongodb-native

Durran Jordan

commit sha be1bfab98facb57b8334d4d37371b9a1b8ace040

test(NODE-3188): backport transaction pinning tests

view details

push time in 2 days

PR opened mongodb/node-mongodb-native

test(NODE-3188): backport transaction pinning tests

Backport of https://github.com/mongodb/node-mongodb-native/pull/2831

+530 -25

0 comment

74 changed files

pr created time in 2 days

create barnchmongodb/node-mongodb-native

branch : NODE-3188-3.6

created branch 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)

durran

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?

W-A-James

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.

NBSquare

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.

NBSquare

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.

NBSquare

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?

NBSquare

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.

NBSquare

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>?

NBSquare

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

NBSquare

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.

W-A-James

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

W-A-James

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).

W-A-James

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

W-A-James

comment created time in 3 days

push eventmongodb/node-mongodb-native

push time in 3 days

push eventmongodb/mongo-rust-driver

Isabel Atkinson

commit sha 53bd873a8a5c0587719a362aefb1d93a0f2b1d0f

RUST-820 Test against 5.0 servers (#360)

view details

push time in 3 days

startedSwiftUIX/Coordinator

started time in 3 days

push eventmongodb/node-mongodb-native

Daria Pardue

commit sha 9608c6a46cea0ec536debd47492fe4007391d6fa

refactor(NODE-3291)!: Standardize error representation in the driver (#2824)

view details

Daria Pardue

commit sha 28533dadb43d0130382a6be02f90c337a9adc297

refactor: rename apm spec directory to command-monitoring

view details

Daria Pardue

commit sha c301c1e34b7bc3a88667fbdd5fdbae3acf88c154

Sync redacted commands spec tests

view details

Daria Pardue

commit sha 980f167612442f3293c5a8b85026aa34b3416a0a

Skip failing spec tests

view details

Daria Pardue

commit sha da577c34a8da60b85040687a31232ee052d44262

Move legacy command-monitoring spec tests into their own folder

view details

push time in 3 days

push eventmongodb/node-mongodb-native

Durran Jordan

commit sha 5a6279ac436fd37158d98f80b302e1affac4a406

test(NODE-3284): add maxPoolSize=0 spec tests (#2830)

view details

Anna Henningsen

commit sha 0d91da1b1388e6946ec991fee82f92647a199ece

feat(NODE-3333): support 'let' option for CRUD commands (#2829)

view details

Daria Pardue

commit sha 9608c6a46cea0ec536debd47492fe4007391d6fa

refactor(NODE-3291)!: Standardize error representation in the driver (#2824)

view details

Warren James

commit sha e5d43667cb539de5975bbdf70413eb7e7399f28d

stared fix for NODE-1502

view details

Warren James

commit sha 5addcc6cede1954e7dfe1a2baf9be5aafe5b8d31

finished NODE-1502

view details

Warren James

commit sha 103b3d5d4e3c1eaabbeb97e53bedd302f8bd0829

Fixed formatting

view details

Warren James

commit sha 88f30b455b6b7a92012c61b4a909739484f70b1a

Changed scope of clonedCommand variable

view details

Warren James

commit sha 61328bf4139daa43fca09f56f81aa5db31e7133f

Added test to ensure that copying commands for command monitoring works as expected

view details

Warren James

commit sha c950d95a0392c919205ad320e2188317a9f6273a

Made deep copies of command fields when extracting commands in src/cmap/command_monitoring_events.ts

view details

Warren James

commit sha 8164edd1da8c6ac1ba9dbf07031b41c6a2c2c994

Reverted changes to src/cmap/connection.ts

view details

Warren James

commit sha 85eb06af9628a83fa8179e4ea20798eaa160a78b

Made test for NODE-1502 account for nested documents

view details

Warren James

commit sha 0761b5ee5c27a19e1ab74019c766fcb30ce0000b

Added test metadata to ensure test only runs on mongodb versions >=3.6.0

view details

Warren James

commit sha 2a332180bab7c55da5c8ac9cb39821cc8102fe17

fixed bug extractCommand in src/cmap/command_monitoring_events.ts

view details

Warren James

commit sha dcdecb12028d1ebf66c8f8bf93a5841203e0b173

Removed unused import

view details

Warren James

commit sha 59a3e7335244863860c551894ff7c1fb5e9c91a8

Resolved review comments

view details

Warren James

commit sha a124325aa77a9983c83d78fdeda71fb225dee5cc

Cleaning up after test

view details

Warren James

commit sha 4560e9d581e66b0ea3056b21ecf3ba757e56807e

Added unit test to ensure the CommandStartedEvents do not hold references to commands passed into the constructor

view details

Warren James

commit sha 7fe88189add0b35ee036ba742d0f85f2623323b4

fix: removed unneeded boilerplate from test

view details

Warren James

commit sha b6c58ae35c5bba0568e8a83d45235ebe4678f4c4

fix: removed done callback and changed forEach to for of loop

view details

Warren James

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

view details

push time in 3 days

PR opened mongodb/mongo-rust-driver

RUST-652 Add script to run all linter tests

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.

+9 -0

0 comment

1 changed file

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!

abr-egn

comment created time in 3 days