Exemple #1
0
    def test_FilterMerge(self):
        self.assertEqual(qf.sort(qf.ASCENDING('x') + qf.DESCENDING('y')),
                         qf.sort(qf.ASCENDING('x')) + qf.sort(qf.DESCENDING('y')))

        comment = "hello world"

        yield self.db.command("profile", 2)
        yield self.coll.find({}, filter=qf.sort(qf.ASCENDING('x')) + qf.comment(comment))
        yield self.db.command("profile", 0)

        cnt = yield self.db.system.profile.count({"query.$orderby.x": 1,
                                                  "query.$comment": comment})
        self.assertEqual(cnt, 1)
Exemple #2
0
    def test_FilterMerge(self):
        self.assertEqual(qf.sort(qf.ASCENDING('x') + qf.DESCENDING('y')),
                         qf.sort(qf.ASCENDING('x')) + qf.sort(qf.DESCENDING('y')))

        comment = "hello world"

        yield self.db.command("profile", 2)
        yield self.coll.find({}, filter=qf.sort(qf.ASCENDING('x')) + qf.comment(comment))
        yield self.db.command("profile", 0)

        if (yield self.__3_2_or_higher()):
            profile_filter = {"query.sort.x": 1, "query.comment": comment}
        else:
            profile_filter = {"query.$orderby.x": 1, "query.$comment": comment}
        cnt = yield self.db.system.profile.count(profile_filter)
        self.assertEqual(cnt, 1)
Exemple #3
0
    def test_Comment(self):
        comment = "hello world"

        # Checking that $comment appears in profiler log
        yield self.db.system.profile.drop()

        yield self.db["$cmd"].find_one({"profile": 2})
        yield self.coll.find({}, filter=qf.comment(comment))
        yield self.db["$cmd"].find_one({"profile": 0})

        cnt = yield self.db.system.profile.count({"query.$comment": comment})

        try:
            self.assertEqual(cnt, 1)

        finally:
            yield self.db.system.profile.drop()
Exemple #4
0
    def test_FilterMerge(self):
        self.assertEqual(
            qf.sort(qf.ASCENDING('x') + qf.DESCENDING('y')),
            qf.sort(qf.ASCENDING('x')) + qf.sort(qf.DESCENDING('y')))

        comment = "hello world"

        yield self.db.command("profile", 2)
        yield self.coll.find({},
                             filter=qf.sort(qf.ASCENDING('x')) +
                             qf.comment(comment))
        yield self.db.command("profile", 0)

        cnt = yield self.db.system.profile.count({
            "query.$orderby.x": 1,
            "query.$comment": comment
        })
        self.assertEqual(cnt, 1)
Exemple #5
0
    def test_FilterMerge(self):
        self.assertEqual(
            qf.sort(qf.ASCENDING('x') + qf.DESCENDING('y')),
            qf.sort(qf.ASCENDING('x')) + qf.sort(qf.DESCENDING('y')))

        comment = "hello world"

        yield self.db.command("profile", 2)
        yield self.coll.find({},
                             filter=qf.sort(qf.ASCENDING('x')) +
                             qf.comment(comment))
        yield self.db.command("profile", 0)

        if (yield self.__3_2_or_higher()):
            profile_filter = {"query.sort.x": 1, "query.comment": comment}
        else:
            profile_filter = {"query.$orderby.x": 1, "query.$comment": comment}
        cnt = yield self.db.system.profile.count(profile_filter)
        self.assertEqual(cnt, 1)
Exemple #6
0
    def test_Comment(self):
        comment = "hello world"

        yield self.__test_simple_filter(qf.comment(comment), "comment", comment)
Exemple #7
0
    def test_Comment(self):
        comment = "hello world"

        yield self.__test_simple_filter(qf.comment(comment), "comment",
                                        comment)