'Ensure that the default ordering can be cleared by calling
order_by() w/o any arguments.'

def test_clear_ordering(self):

    class BlogPost(Document, ):
        title = StringField()
        published_date = DateTimeField()
        meta = {'ordering': ['-published_date']}
    BlogPost.drop_collection()
    with db_ops_tracker() as q:
        BlogPost.objects.filter(title='whatever').first()
        self.assertEqual(len(q.get_ops()), 1)
        self.assertEqual(q.get_ops()[0]['query']['$orderby'], {'published_date': (-1)})
    with db_ops_tracker() as q:
        BlogPost.objects.filter(title='whatever').order_by().first()
        self.assertEqual(len(q.get_ops()), 1)
        self.assertFalse(('$orderby' in q.get_ops()[0]['query']))
    with db_ops_tracker() as q:
        BlogPost.objects.filter(title='whatever').order_by('published_date').first()
        self.assertEqual(len(q.get_ops()), 1)
        self.assertEqual(q.get_ops()[0]['query']['$orderby'], {'published_date': 1})
    with db_ops_tracker() as q:
        qs = BlogPost.objects.filter(title='whatever').order_by('published_date')
        qs.order_by().first()
        self.assertEqual(len(q.get_ops()), 1)
        self.assertFalse(('$orderby' in q.get_ops()[0]['query']))
