[DRIVERS-2018] Language specific examples for AWS Lambda Created: 05/Jan/22  Updated: 22/Feb/23  Resolved: 22/Feb/23

Status: Closed
Project: Drivers
Component/s: Docs Examples
Fix Version/s: None

Type: Epic Priority: Major - P3
Reporter: Bernie Hackett Assignee: Unassigned
Resolution: Done Votes: 1
Labels: size-medium
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split to CDRIVER-4324 Language specific examples for AWS La... Closed
split to CSHARP-4127 Language specific examples for AWS La... Closed
split to CXX-2481 Language specific examples for AWS La... Closed
split to GODRIVER-2368 Language specific examples for AWS La... Closed
split to JAVA-4474 Language specific examples for AWS La... Closed
split to MOTOR-923 Language specific examples for AWS La... Closed
split to NODE-4160 Language specific examples for AWS La... Closed
split to PHPLIB-833 Language specific examples for AWS La... Closed
split to PYTHON-3097 Language specific examples for AWS La... Closed
split to RUBY-2945 Language specific examples for AWS La... Closed
split to RUST-1253 Language specific examples for AWS La... Closed
Related
Driver Changes: Needed
Quarter: FY23Q2
Downstream Changes Summary:

Write language specific versions of the existing Javascript example for AWS Lambda and test that the examples work.
See the relevant scope section for details. 

Case:
Engineering Lead: Bernie Hackett Bernie Hackett
Product Manager: Rachelle Palmer Rachelle Palmer
Program Manager: Martin Bajana Martin Bajana
Cost Threshold %: 100
Driver Compliance:
Key Status/Resolution FixVersion
PYTHON-3097 Fixed 4.2
CDRIVER-4324 Won't Do
CXX-2481 Won't Do
CSHARP-4127 Fixed 2.17.0
GODRIVER-2368 Done 1.12.0, 1.12.0-alpha1
NODE-4160 Fixed 4.10.0
MOTOR-923 Done
PHPLIB-833 Won't Do
RUBY-2945 Fixed 2.18.0
RUST-1253 Fixed 2.4.0
SWIFT-1536 Fixed 1.4.0
JAVA-4474 Done

 Description   

We field a lot of complaints about the behavior of drivers when using AWS Lambda. Lambda is a stateless function as a service provider. Drivers maintain a ton of state. A Lambda application has to be written a specific way to ensure an instance of MongoClient is reused on each invocation of a lambda function. Happily, our docs team wrote a guide:

https://docs.atlas.mongodb.com/best-practices-connecting-from-aws-lambda/

Sadly the guide only provides Javascript examples. It also only covers AWS Lambda, not Azure Functions, which are getting popular for .NET developers and are likely to get popular for other languages.

This ticket proposes writing language specific versions of the existing Javascript example for AWS Lambda and test that the examples work.

There will be a dependent ticket in the DOCS project to add these new examples to the existing docs.



 Comments   
Comment by Oleg Pudeyev (Inactive) [ 25/Apr/22 ]

Any find or insert operation should work, for example using Ruby syntax:

client['greetings'].insert_one(message: 'hello, world!')
client['greetings'].find.to_a

alek.antoniewicz@mongodb.com I expect drivers that do no i/o in constructor to behave in the described manner.

Comment by Bernie Hackett [ 25/Apr/22 ]

oleg.pudeyev@mongodb.com can you make a proposal to fix that in the smallest way possible?

Comment by Oleg Pudeyev (Inactive) [ 25/Apr/22 ]

These examples as requested print the configured database name which will be done regardless of whether the connection to deployment succeeds. In other words, someone can type up the code in these examples, run it, it will run successfully but their client wouldn't have connected to the deployment and hence no actual operations would work once they try to execute any.

Comment by PM Bot [ 18/Jan/22 ]

If you are not logged in, you can view the tickets in this epic by following this link.

Comment by Jonathan DeStefano [ 06/Jan/22 ]

Thanks for the heads up, great idea. I scheduled some time for us to discuss as a group and flesh this out a bit more.

Comment by Bernie Hackett [ 05/Jan/22 ]

We should also suggest that users of function as a service providers use Atlas Serverless. Drivers work in load balancer mode for Atlas Serverless, eliminating almost all of SDAM (though not connection pooling).

Comment by Drew DiPalma (Inactive) [ 05/Jan/22 ]

Cloudflare Workers do not support the MongoDB drivers and I don't believe Cloudflare is planning to support them in the near future.  We recently partnered with Cloudflare to show how you can use a Realm SDK as Joe notes (see here and here) and the Data API would also be an option. 

 

Generally, we may also want to note that the Data API is a good option for serverless as it will take care of connection pooling and some users will prefer REST vs. Driver.  

Comment by Rita Martins Rodrigues (Inactive) [ 05/Jan/22 ]

Thank you Joe.

jonathan.destefano let's discuss how we should collaborate on this one. 

Comment by Joe Drumgoole (Inactive) [ 05/Jan/22 ]

cc jonathan.destefano r.rodrigues

 

We should decide who can pick up this work between dev rel and docs. We have content for CloudFlare : https://www.mongodb.com/developer/how-to/cloudflare-worker-rest-api-realm/

 

Comment by Bernie Hackett [ 05/Jan/22 ]

FYI will.shulman

Generated at Thu Feb 08 08:24:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.