(terms ...interface{})
| 212 | } |
| 213 | |
| 214 | func (col *Collection) compileQuery(terms ...interface{}) interface{} { |
| 215 | compiled := col.compileConditions(terms) |
| 216 | if compiled == nil { |
| 217 | return nil |
| 218 | } |
| 219 | |
| 220 | conditions := compiled.([]interface{}) |
| 221 | if len(conditions) == 1 { |
| 222 | return conditions[0] |
| 223 | } |
| 224 | // this should be correct. |
| 225 | // query = map[string]interface{}{"$and": conditions} |
| 226 | |
| 227 | // attempt to workaround https://jira.mongodb.org/browse/SERVER-4572 |
| 228 | mapped := map[string]interface{}{} |
| 229 | for _, v := range conditions { |
| 230 | for kk := range v.(map[string]interface{}) { |
| 231 | mapped[kk] = v.(map[string]interface{})[kk] |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | return mapped |
| 236 | } |
| 237 | |
| 238 | // Name returns the name of the table or tables that form the collection. |
| 239 | func (col *Collection) Name() string { |
no test coverage detected