Permalink
Browse files

formatted objects bson

  • Loading branch information...
1 parent 7378167 commit 2fbf335334a22436a5ec4c4129d1521bb0f6c851 John Mac committed with Jun 18, 2010
Showing with 23 additions and 2 deletions.
  1. +8 −1 mongo/collection.go
  2. +15 −1 mongo/database.go
View
@@ -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
View
@@ -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
}

0 comments on commit 2fbf335

Please sign in to comment.