Hi to all,
iam using pymongo and i need to create timeseries collection, the code is
client = MongoClient()
db = client[CoinsTimeSeries.get_db().name]
print(db.list_collection_names(),)
if 'coins_timeseries' not in db.list_collection_names():
meta = {
'timeseries': {
'timeField': 'timestamp',
'metaField': 'symbol',
'granularity': 'seconds'
},
"storageEngine" : {
"wiredTiger" : {
"configString" : "block_compressor=zstd"
}
},
'indexes': [
'symbol',
('timestamp', 'symbol')
]
}
print("Creating new timeseries collection...")
db.command('create', 'coins_timeseries', timeseries={ 'timeseries': {
'timeField': 'timestamp',
'metaField': 'symbol',
'granularity': 'seconds'
},
'indexes': [
'symbol',
('timestamp', 'symbol')
] },)
else:
print("Exsits...")
when i use this
print(db.list_collection_names(),)
the result is
['system.views', 'coins_timeseries',]
and it does not show any collection with this name in mongo compos or any other interfaces
please tell me
where is the problem
thank you in advanced