Commit 74bf9537 authored by Somnath Ghorpade's avatar Somnath Ghorpade
Browse files

Added find allowDiskUse options.

parent 5c31ae9e
Branches SG_Findops
No related merge requests found
Showing with 6 additions and 3 deletions
...@@ -152,7 +152,7 @@ func InitNewSession(hostDetails MongoHost) error { ...@@ -152,7 +152,7 @@ func InitNewSession(hostDetails MongoHost) error {
return nil return nil
} }
//GetMongoConnection method // GetMongoConnection method
func GetMongoConnection(hostName string) (*mongo.Client, error) { func GetMongoConnection(hostName string) (*mongo.Client, error) {
mutex.Lock() mutex.Lock()
defer mutex.Unlock() defer mutex.Unlock()
...@@ -359,7 +359,7 @@ func (mg *MongoDAO) DeleteAll(selector map[string]interface{}) error { ...@@ -359,7 +359,7 @@ func (mg *MongoDAO) DeleteAll(selector map[string]interface{}) error {
return deleteError return deleteError
} }
//Set Find Options // Set Find Options
func (mg *MongoDAO) SetFindOps(findOps map[string]interface{}) { func (mg *MongoDAO) SetFindOps(findOps map[string]interface{}) {
mg.MetaData.Findops = findOps mg.MetaData.Findops = findOps
} }
...@@ -405,6 +405,9 @@ func (mg *MongoDAO) GetProjectedData(selector map[string]interface{}, projector ...@@ -405,6 +405,9 @@ func (mg *MongoDAO) GetProjectedData(selector map[string]interface{}, projector
}) })
ops.SetSort(sort) ops.SetSort(sort)
} }
if obj.Get("allowDiskUse").Value() != nil {
ops.SetAllowDiskUse(obj.Get("allowDiskUse").Bool())
}
} }
ops.Projection = projector ops.Projection = projector
cur, err := collection.Find(context.Background(), selector, ops) cur, err := collection.Find(context.Background(), selector, ops)
...@@ -551,7 +554,7 @@ func (mg *MongoDAO) PushData(selector map[string]interface{}, data interface{}) ...@@ -551,7 +554,7 @@ func (mg *MongoDAO) PushData(selector map[string]interface{}, data interface{})
return nil return nil
} }
//set update option for custom update // set update option for custom update
func (mg *MongoDAO) SetUpdateOps(updateOps map[string]interface{}) { func (mg *MongoDAO) SetUpdateOps(updateOps map[string]interface{}) {
mg.MetaData.UpdateOps = updateOps mg.MetaData.UpdateOps = updateOps
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment