forked from bububa/MongoHub-Mac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MongoDB.h
141 lines (134 loc) · 6.13 KB
/
MongoDB.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//
// Mongo.h
// MongoHub
//
// Created by Syd on 10-4-25.
// Copyright 2010 MusicPeace.ORG. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <mongo/client/dbclient.h>
@interface MongoDB : NSObject {
mongo::DBClientConnection *conn;
mongo::DBClientReplicaSet::DBClientReplicaSet *repl_conn;
BOOL isRepl;
}
- (mongo::DBClientConnection *)mongoConnection;
- (mongo::DBClientReplicaSet::DBClientReplicaSet *)mongoReplConnection;
- (id)initWithConn:(NSString *)host;
- (id)initWithConn:(NSString *)name
hosts:(NSArray *)hosts;
- (bool)connect:(NSString *)host;
- (bool)connect:(NSString *)name
hosts:(NSArray *)hosts;
- (bool)authUser:(NSString *)user
pass:(NSString *)pass
database:(NSString *)db;
- (NSArray *)listDatabases;
- (NSArray *)listCollections:(NSString *)db
user:(NSString *)user
password:(NSString *)password;
- (NSMutableArray *) serverStatus;
- (NSMutableArray *) dbStats:(NSString *)dbname
user:(NSString *)user
password:(NSString *)password;
- (void) dropDB:(NSString *)dbname
user:(NSString *)user
password:(NSString *)password;
- (NSMutableArray *) collStats:(NSString *)collectionname
forDB:(NSString *)dbname
user:(NSString *)user
password:(NSString *)password;
- (void) createCollection:(NSString *)collectionname
forDB:(NSString *)dbname
user:(NSString *)user
password:(NSString *)password;
- (void) dropCollection:(NSString *)collectionname
forDB:(NSString *)dbname
user:(NSString *)user
password:(NSString *)password;
- (NSMutableArray *) findInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
critical:(NSString *)critical
fields:(NSString *)fields
skip:(NSNumber *)skip
limit:(NSNumber *)limit
sort:(NSString *)sort;
- (void) saveInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
jsonString:(NSString *)jsonString
_id:(NSString *)_id;
- (void) updateInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
critical:(NSString *)critical
fields:(NSString *)fields
upset:(NSNumber *)upset;
- (void) removeInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
critical:(NSString *)critical;
- (void) insertInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
insertData:(NSString *)insertData;
- (void) insertInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
data:(NSDictionary *)insertData
fields:(NSArray *)fields
fieldTypes:(NSDictionary *)fieldTypes;
- (NSMutableArray *) indexInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password;
- (void) ensureIndexInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
indexData:(NSString *)indexData;
- (void) reIndexInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password;
- (void) dropIndexInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
indexName:(NSString *)indexName;
- (long long int) countInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
critical:(NSString *)critical;
- (NSMutableArray *)mapReduceInDB:dbname
collection:collectionname
user:user
password:password
mapJs:mapFunction
reduceJs:reduceFunction
critical:critical
output:output;
- (NSMutableArray *) bsonDictWrapper:(mongo::BSONObj)retval;
- (NSMutableArray *) bsonArrayWrapper:(mongo::BSONObj)retval;
- (std::auto_ptr<mongo::DBClientCursor>) findAllCursorInDB:(NSString *)dbname collection:(NSString *)collectionname user:(NSString *)user password:(NSString *)password fields:(mongo::BSONObj) fields;
- (std::auto_ptr<mongo::DBClientCursor>) findCursorInDB:(NSString *)dbname collection:(NSString *)collectionname user:(NSString *)user password:(NSString *)password critical:(NSString *)critical fields:(NSString *)fields skip:(NSNumber *)skip limit:(NSNumber *)limit sort:(NSString *)sort;
- (void) updateBSONInDB:(NSString *)dbname
collection:(NSString *)collectionname
user:(NSString *)user
password:(NSString *)password
critical:(mongo::Query)critical
fields:(mongo::BSONObj)fields
upset:(bool)upset;
- (mongo::BSONObj) serverStat;
- (NSDictionary *) serverMonitor:(mongo::BSONObj)a second:(mongo::BSONObj)b currentDate:(NSDate *)now previousDate:(NSDate *)previous;
- (double) diff:(NSString *)aName first:(mongo::BSONObj)a second:(mongo::BSONObj)b timeInterval:(NSTimeInterval)interval;
- (double) percent:(NSString *)aOut value:(NSString *)aVal first:(mongo::BSONObj)a second:(mongo::BSONObj)b;
@end