🍃 New features!
Pre-release
Pre-release
Finally we come to an update with some new features!
Right away, recap:
🐛 Bugs
- Fix syntaxes typos (
[a [new]]
->[[a] new]
) (477d76e) - Make Skript dependent instead of softdependent (should fix some issues on some MC hosting providers) (cf0f385)
✨ Features
- Introducing array support in joined filters expression (ebf2dc7)
- Introducing Mongo collection creation (4ca89cc)
- Introducing Mongo database and collection drops (ee18121)
- Allow use of raw BSON documents (f7c37fd), i.e. :
{
"foo": {
"bar": true
},
"array": [
{
"test": false
}
]
}
set {_doc} to a new mongo document
set mongo json of {_doc} to "{""foo"":{""bar"":true},""array"":[{""test"":false}]}"
set {_fooDoc} to mongo value "foo" of {_doc} # {_fooDoc} = {"bar":true}
set {_bar} to mongo value "bar" of {_fooDoc} # {_bar} = true
set {_array::*} to mongo list "array" of {_doc}
set {_first} to {_array::1} # {_array::1} = {"test":false}
set {_test} to mongo value "test" of {_first} # {_test} = false
- Introducing Mongo commands! (0a23b45), i.e. :
on script load:
set {server} to mongo server with connection string "mongodb://127.0.0.1"
set {database} to mongo database named "mongosk" of {server}
function getClusterVersion() :: string:
set {_docs::*} to results of mongo command "{ ""serverStatus"": 1 }" in database {database}
set {_doc} to {_docs::1}
# or directly:
set {_doc} to first element of results of mongo command "{ ""serverStatus"": 1 }" in database {database}
# return the mongo value "version" of the returned document:
set {_version} to mongo value "version" of {_doc}
return {_version}
on mongo command start:
broadcast "Mongo command %event-mongodocument% in collection named %event-string% started!"
on mongo command success:
broadcast "Mongo command %event-mongodocument% succedeed in %event-number% ms!"
on mongo command fail:
broadcast "A Mongo command failed with error: %event-string% (took %event-number% ms)!"
That's it for today. And that's not bad.
Thanks to you for your feedback! As always, don't hesitate to contact me if you have any problem.