Documentation ¶
Index ¶
- func Dial(url string, dbname string, ac async.AsyncCallback)
- type DB
- func (mdb *DB) Close(ac async.AsyncCallback)
- func (mdb *DB) Count(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ...)
- func (mdb *DB) DropCollection(collectionName string, ac async.AsyncCallback)
- func (mdb *DB) DropDatabase(ac async.AsyncCallback)
- func (mdb *DB) DropIndex(collectionName string, keys []string, ac async.AsyncCallback)
- func (mdb *DB) EnsureIndex(collectionName string, index mgo.Index, ac async.AsyncCallback)
- func (mdb *DB) EnsureIndexKey(collectionName string, keys []string, ac async.AsyncCallback)
- func (mdb *DB) FindAll(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ...)
- func (mdb *DB) FindId(collectionName string, id interface{}, setupQuery func(query *mgo.Query), ...)
- func (mdb *DB) FindOne(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ...)
- func (mdb *DB) Insert(collectionName string, doc bson.M, ac async.AsyncCallback)
- func (mdb *DB) InsertMany(collectionName string, docs []bson.M, ac async.AsyncCallback)
- func (mdb *DB) Remove(collectionName string, query bson.M, ac async.AsyncCallback)
- func (mdb *DB) RemoveAll(collectionName string, query bson.M, ac async.AsyncCallback)
- func (mdb *DB) RemoveId(collectionName string, id interface{}, ac async.AsyncCallback)
- func (mdb *DB) SetMode(consistency mgo.Mode, ac async.AsyncCallback)
- func (mdb *DB) Update(collectionName string, query bson.M, update bson.M, ac async.AsyncCallback)
- func (mdb *DB) UpdateAll(collectionName string, query bson.M, update bson.M, ac async.AsyncCallback)
- func (mdb *DB) UpdateId(collectionName string, id interface{}, update bson.M, ac async.AsyncCallback)
- func (mdb *DB) Upsert(collectionName string, query bson.M, update bson.M, ac async.AsyncCallback)
- func (mdb *DB) UpsertId(collectionName string, id interface{}, update bson.M, ac async.AsyncCallback)
- func (mdb *DB) UseDB(dbname string, ac async.AsyncCallback)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
MongoDB is a MongoDB instance can be used to manipulate Mongo DBs
func (*DB) Count ¶
func (mdb *DB) Count(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ac async.AsyncCallback)
Count counts the number of documents by query
func (*DB) DropCollection ¶
func (mdb *DB) DropCollection(collectionName string, ac async.AsyncCallback)
DropCollection drops c collection
func (*DB) DropDatabase ¶
func (mdb *DB) DropDatabase(ac async.AsyncCallback)
DropDatabase drops the database
func (*DB) DropIndex ¶
func (mdb *DB) DropIndex(collectionName string, keys []string, ac async.AsyncCallback)
DropIndex drops an index by keys
func (*DB) EnsureIndex ¶
func (mdb *DB) EnsureIndex(collectionName string, index mgo.Index, ac async.AsyncCallback)
EnsureIndex creates an index
func (*DB) EnsureIndexKey ¶
func (mdb *DB) EnsureIndexKey(collectionName string, keys []string, ac async.AsyncCallback)
EnsureIndexKey creates an index by keys
func (*DB) FindAll ¶
func (mdb *DB) FindAll(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ac async.AsyncCallback)
FindAll finds all documents with specified query
func (*DB) FindId ¶
func (mdb *DB) FindId(collectionName string, id interface{}, setupQuery func(query *mgo.Query), ac async.AsyncCallback)
FindId finds document in collection by Id
func (*DB) FindOne ¶
func (mdb *DB) FindOne(collectionName string, query bson.M, setupQuery func(query *mgo.Query), ac async.AsyncCallback)
FindOne finds one document with specified query
func (*DB) InsertMany ¶
InsertMany inserts multiple documents
func (*DB) RemoveId ¶
func (mdb *DB) RemoveId(collectionName string, id interface{}, ac async.AsyncCallback)
RemoveId removes a document by id
func (*DB) SetMode ¶
func (mdb *DB) SetMode(consistency mgo.Mode, ac async.AsyncCallback)
SetMode sets the consistency mode
func (*DB) UpdateAll ¶
func (mdb *DB) UpdateAll(collectionName string, query bson.M, update bson.M, ac async.AsyncCallback)
UpdateAll updates all documents by query
func (*DB) UpdateId ¶
func (mdb *DB) UpdateId(collectionName string, id interface{}, update bson.M, ac async.AsyncCallback)
UpdateId updates a document by id
Click to show internal directories.
Click to hide internal directories.