-
Notifications
You must be signed in to change notification settings - Fork 180
RUST-666 Add options for timeseries collection creation #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
abr-egn
merged 7 commits into
mongodb:master
from
abr-egn:RUST-666/time-series-collection
Jun 30, 2021
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9e3603b
add timeseries options for collection creation
abr-egn b9d35f1
pull in collection-management tests; shift expire_after_seconds up a …
abr-egn 6733395
properly [de]serialize expire_after_seconds, and expose granularity
abr-egn 0a38dfa
serde(default) for expire_after_seconds
abr-egn cf1c6a2
rustfmt
abr-egn 2211c95
formatting
abr-egn b76e001
Update comment to indicate version support
abr-egn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use crate::test::{run_spec_test, LOCK}; | ||
|
||
use super::run_unified_format_test; | ||
|
||
#[cfg_attr(feature = "tokio-runtime", tokio::test)] | ||
#[cfg_attr(feature = "async-std-runtime", async_std::test)] | ||
async fn run() { | ||
let _guard = LOCK.run_exclusively().await; | ||
run_spec_test(&["collection-management"], run_unified_format_test).await; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
=========================== | ||
Collection Management Tests | ||
=========================== | ||
|
||
This directory contains tests for collection management. They are implemented | ||
in the `Unified Test Format <../../unified-test-format/unified-test-format.rst>`__ | ||
and require schema version 1.0. |
255 changes: 255 additions & 0 deletions
255
src/test/spec/json/collection-management/timeseries-collection.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
{ | ||
"description": "timeseries-collection", | ||
"schemaVersion": "1.0", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "5.0" | ||
} | ||
], | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"observeEvents": [ | ||
"commandStartedEvent" | ||
] | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "ts-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "test" | ||
} | ||
} | ||
], | ||
"initialData": [ | ||
{ | ||
"collectionName": "test", | ||
"databaseName": "ts-tests", | ||
"documents": [] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "createCollection with all options", | ||
"operations": [ | ||
{ | ||
"name": "dropCollection", | ||
"object": "database0", | ||
"arguments": { | ||
"collection": "test" | ||
} | ||
}, | ||
{ | ||
"name": "createCollection", | ||
"object": "database0", | ||
"arguments": { | ||
"collection": "test", | ||
"expireAfterSeconds": 604800, | ||
"timeseries": { | ||
"timeField": "time", | ||
"metaField": "meta", | ||
"granularity": "minutes" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "assertCollectionExists", | ||
"object": "testRunner", | ||
"arguments": { | ||
"databaseName": "ts-tests", | ||
"collectionName": "test" | ||
} | ||
} | ||
], | ||
"expectEvents": [ | ||
{ | ||
"client": "client0", | ||
"events": [ | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"drop": "test" | ||
}, | ||
"databaseName": "ts-tests" | ||
} | ||
}, | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"create": "test", | ||
"expireAfterSeconds": 604800, | ||
"timeseries": { | ||
"timeField": "time", | ||
"metaField": "meta", | ||
"granularity": "minutes" | ||
} | ||
}, | ||
"databaseName": "ts-tests" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "insertMany with duplicate ids", | ||
"operations": [ | ||
{ | ||
"name": "dropCollection", | ||
"object": "database0", | ||
"arguments": { | ||
"collection": "test" | ||
} | ||
}, | ||
{ | ||
"name": "createCollection", | ||
"object": "database0", | ||
"arguments": { | ||
"collection": "test", | ||
"expireAfterSeconds": 604800, | ||
"timeseries": { | ||
"timeField": "time", | ||
"metaField": "meta", | ||
"granularity": "minutes" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "assertCollectionExists", | ||
"object": "testRunner", | ||
"arguments": { | ||
"databaseName": "ts-tests", | ||
"collectionName": "test" | ||
} | ||
}, | ||
{ | ||
"name": "insertMany", | ||
"object": "collection0", | ||
"arguments": { | ||
"documents": [ | ||
{ | ||
"_id": 1, | ||
"time": { | ||
"$date": { | ||
"$numberLong": "1552949630482" | ||
} | ||
} | ||
}, | ||
{ | ||
"_id": 1, | ||
"time": { | ||
"$date": { | ||
"$numberLong": "1552949630483" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"name": "find", | ||
"object": "collection0", | ||
"arguments": { | ||
"filter": {}, | ||
"sort": { | ||
"time": 1 | ||
} | ||
}, | ||
"expectResult": [ | ||
{ | ||
"_id": 1, | ||
"time": { | ||
"$date": { | ||
"$numberLong": "1552949630482" | ||
} | ||
} | ||
}, | ||
{ | ||
"_id": 1, | ||
"time": { | ||
"$date": { | ||
"$numberLong": "1552949630483" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"expectEvents": [ | ||
{ | ||
"client": "client0", | ||
"events": [ | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"drop": "test" | ||
}, | ||
"databaseName": "ts-tests" | ||
} | ||
}, | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"create": "test", | ||
"expireAfterSeconds": 604800, | ||
"timeseries": { | ||
"timeField": "time", | ||
"metaField": "meta", | ||
"granularity": "minutes" | ||
} | ||
}, | ||
"databaseName": "ts-tests" | ||
} | ||
}, | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"insert": "test", | ||
"documents": [ | ||
{ | ||
"_id": 1, | ||
"time": { | ||
"$date": { | ||
"$numberLong": "1552949630482" | ||
} | ||
} | ||
}, | ||
{ | ||
"_id": 1, | ||
"time": { | ||
"$date": { | ||
"$numberLong": "1552949630483" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"commandStartedEvent": { | ||
"command": { | ||
"find": "test", | ||
"filter": {}, | ||
"sort": { | ||
"time": 1 | ||
} | ||
}, | ||
"databaseName": "ts-tests" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why this field needs to be explicitly marked as using the default when it's not present when others don't, but without this annotation some tests fail in deserialization complaining about
missing field "expireAfterSeconds"
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's because we provide special serialization / deserialization helpers for this field which override the default behavior.