-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Component/s: Docs Examples
-
None
-
Needed
-
The server documentation team would like to add driver examples for snapshot queries. I've mocked up the examples we want to use in Python. I've also included the delineation we'd like to use:
// Start Snapshot Query Example 1 client = MongoClient() db = client.pets with client.start_session(snapshot=True) as s: adoptablePetsCount = db.cats.aggregate( [ { "$match": { "adoptable": true } }, { "$count": "adoptableCatsCount" } ], session=s ).next()["adoptableCatsCount"] adoptablePetsCount += db.dogs.aggregate( [ { "$match": { "adoptable": True} }, { "$count": "adoptableDogsCount" } ], session=s ).next()["adoptableDogsCount"] print(adoptablePetsCount) // End Snapshot Query Example 1 // Start Snapshot Query Example 2 client = MongoClient() db = client.retail with client.start_session(snapshot=True) as s: total = db.sales.aggregate( [ { $match: { $expr: { $gt: [ "$saleDate", { $dateSubtract: { startDate: "$$NOW", unit: "day", amount: 1 } } ] } } }, { $count: "totalDailySales" } ], session=s ).next()["totalDailySales"] // End Snapshot Query Example 2
The examples will appear on this page: https://docs-mongodbcom-staging.corp.mongodb.com/docs/docsworker-xlarge/DOCS-15065/tutorial/long-running-queries/
Let me know if you need any more information. Thank you for your help!
- related to
-
SERVER-63887 SnapshotUnavailable error on sharded clusters/replica sets
- Closed
- split to
-
CSHARP-4055 Snapshot Query Examples for the Manual
- Backlog
-
JAVA-5422 Java Fundamentals: Snapshot Queries
- Backlog
-
NODE-6103 Node.js: Snapshot Queries
- Backlog
-
RUST-1187 Snapshot Query Examples for the Manual
- Backlog
-
CDRIVER-4295 Snapshot Query Examples for the Manual
- Closed
-
CXX-2454 Snapshot Query Examples for the Manual
- Closed
-
GODRIVER-2310 Snapshot Query Examples for the Manual
- Closed
-
MOTOR-894 Snapshot Query Examples for the Manual
- Closed
-
PHPLIB-789 Snapshot Query Examples for the Manual
- Closed
-
PYTHON-3127 Snapshot Query Examples for the Manual
- Closed
-
RUBY-2909 Snapshot Query Examples for the Manual
- Closed