Hello guys i am wondering if i have correctly converted this sql query
into mongodb
type.I get less results in mongodb
.
The sql
query is this:
"select * from oneindextwocolumns where timestamp1>='2010-01-01 00:05:00' and timestamp1<='2015-01-01 00:05:00' and id13>5 "
And i have converted it like this:
mydb1.mongodbbucketright.find(
{"samples.timestamp1": {"$gte": datetime.strptime("2010-01-01 00:05:00", "%Y-%m-%d %H:%M:%S"),
"$lte": datetime.strptime("2015-01-01 00:05:00", "%Y-%m-%d %H:%M:%S")},
"samples.id13":{"$gt":5}},
{"samples.$": 1 })
My mongodb data look like this :
{'_id': ObjectId('6068da8878fa2e568c42c7f1'),
'samples': [{'c14': 'C',
'id1': 3758.0,
'id10': 0.0,
'id11': 274.0,
'id12': 0.0,
'id13': 7.5,
'id15': 0.0,
'id16': 73.0,
'id17': 0.0,
'id18': 0.342,
'id19': 6.3,
'id20': 1206.0,
'id21': 0.0,
'id22': 0.87,
'id23': 0.0,
'id6': 2.0,
'id7': -79.09,
'id8': 35.97,
'id9': 5.8,
'timestamp1': datetime.datetime(2018, 1, 24, 14, 5),
'timestamp2': datetime.datetime(2018, 1, 24, 9, 5)},
{'c14': 'C',
'id1': 3758.0,
'id10': 0.0,
'id11': 288.0,
'id12': 0.0,
'id13': 8.4,
'id15': 0.0,
'id16': 71.0,
'id17': 0.0,
'id18': 0.342,
'id19': 6.3,
'id20': 1207.0,
'id21': 0.0,
'id22': 0.69,
'id23': 0.0,
'id6': 2.0,
'id7': -79.09,
'id8': 35.97,
'id9': 6.2,
'timestamp1': datetime.datetime(2018, 1, 24, 14, 10),
'timestamp2': datetime.datetime(2018, 1, 24, 9, 10)},
.
.
.
.
What do you think?Is position projection helping here?
Thanks in advance!