var username = "mongo"
var array = [1,2,3,4]
var dict = ["name": "kitten", "type": "cat"]
let userCollection = database["users"]
let userDocument: Document = [
"username": .string(username),
"array": .array(arr),
"dictionary": .array(dict),
]
try userCollection.insert(userDocument)
error: cannot convert value of type '[Int]' to expected argument type 'Document'
array: .array(array),
^~~~~
Why do you need Document type and why can't we create it dynamically?
Please provide JSON or Dictionary datatype support for queries in mongodb or atleast provide raw query support so that we can use raw strings to query mongo database
Why do you need Document type and why can't we create it dynamically?
Please provide JSON or Dictionary datatype support for queries in mongodb or atleast provide raw query support so that we can use raw strings to query mongo database