mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-27 16:17:34 +00:00
Fix: fail to query the count with mongodb
Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
This commit is contained in:
@@ -275,7 +275,7 @@ func (m *mongodb) Count(ctx context.Context, entity datastore.Entity, filterOpti
|
||||
if entity.Index() != nil {
|
||||
for k, v := range entity.Index() {
|
||||
filter = append(filter, bson.E{
|
||||
Key: k,
|
||||
Key: strings.ToLower(k),
|
||||
Value: v,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -232,6 +232,11 @@ var _ = Describe("Test mongodb datastore driver", func() {
|
||||
}})
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
Expect(count).Should(Equal(int64(3)))
|
||||
|
||||
app.Name = "kubevela-app-3"
|
||||
count, err = mongodbDriver.Count(context.TODO(), &app, &datastore.FilterOptions{})
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
Expect(count).Should(Equal(int64(1)))
|
||||
})
|
||||
|
||||
It("Test isExist function", func() {
|
||||
|
||||
Reference in New Issue
Block a user