Skip to content

Commit

Permalink
formatted objects bson
Browse files Browse the repository at this point in the history
  • Loading branch information
John Mac authored and mikejs committed Jun 18, 2010
1 parent 7378167 commit 2fbf335
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
9 changes: 8 additions & 1 deletion mongo/collection.go
Expand Up @@ -106,7 +106,14 @@ func (coll *Collection) FindOne(query BSON) (BSON, os.Error) {
}

func (coll *Collection) Count(query BSON) (int64, os.Error) {
cmd := &_Object{map[string]BSON{"count": &_String{coll.name, _Null{}}, "query": query}, _Null{}}
cmd := &_Object{
map[string]BSON{
"count": &_String{coll.name, _Null{}},
"query": query,
},
_Null{},
}

reply, err := coll.db.Command(cmd)
if err != nil {
return -1, err
Expand Down
16 changes: 15 additions & 1 deletion mongo/database.go
Expand Up @@ -30,7 +30,21 @@ func (db *Database) Drop() os.Error {
}

func (db *Database) Repair(preserveClonedFilesOnFailure, backupOriginalFiles bool) os.Error {
cmd := &_Object{map[string]BSON{"repairDatabase": &_Number{1, _Null{}}, "preserveClonedFilesOnFailure": &_Boolean{preserveClonedFilesOnFailure, _Null{}}, "backupOriginalFiles": &_Boolean{backupOriginalFiles, _Null{}}}, _Null{}}
cmd := &_Object{
map[string]BSON{
"repairDatabase": &_Number{
1, _Null{},
},
"preserveClonedFilesOnFailure": &_Boolean{
preserveClonedFilesOnFailure, _Null{},
},
"backupOriginalFiles": &_Boolean{
backupOriginalFiles, _Null{},
},
},
_Null{},
}

_, err := db.Command(cmd)
return err
}
Expand Down

0 comments on commit 2fbf335

Please sign in to comment.