Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'generics' of /home/samus/Documents/Projects/mongodb-csh…

…arp into generics
  • Loading branch information...
commit ad2f5da794805f12e86b9d7a2d57973b95f22a03 2 parents 41aae7e + 62ae01c
Sam Corder authored March 09, 2010
29  MongoDB.Net-Tests/TestCursor.cs
... ...
@@ -1,4 +1,6 @@
1 1
 using System;
  2
+using System.Collections.Generic;
  3
+
2 4
 using NUnit.Framework;
3 5
 
4 6
 using MongoDB.Driver;
@@ -138,5 +140,32 @@ public void TestCanReadAndKillCursor()
138 140
             Assert.IsTrue(exp.Contains("n"));
139 141
             Assert.IsTrue(exp.Contains("nscanned"));            
140 142
         }
  143
+        
  144
+        [Test]
  145
+        public void TestSearchWithNonDocument(){
  146
+            IMongoCollection reads = DB["reads"];
  147
+            Dictionary<string, object> fake =  new Dictionary<string, object>(){{"j", 5}};
  148
+            using(ICursor cur = reads.FindAll().Spec(fake)){
  149
+                try{
  150
+                    foreach(Document d in cur.Documents){
  151
+                        d["returned"] = 1; //just do nothing with it.
  152
+                    }
  153
+                }catch(Exception e){
  154
+                    Assert.Fail("Cursor couldn't execute. " + e.Message);
  155
+                }
  156
+            }
  157
+        }
  158
+        
141 159
     }
  160
+    
  161
+//    internal class FakeDoc : IEnumerable<KeyValuePair<string, object>>{
  162
+//        
  163
+//        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator (){
  164
+//            return this.GetEnumerator();
  165
+//        }
  166
+//        
  167
+//        public IEnumerator<KeyValuePair<string, object>> GetEnumerator (){
  168
+//            
  169
+//        }
  170
+//    }
142 171
 }
8  MongoDB.Net-Tests/TestDocument.cs
... ...
@@ -1,10 +1,6 @@
1  
-/*
2  
- * User: scorder
3  
- * Date: 7/8/2009
4  
- */
5  
-
6 1
 using System;
7 2
 using System.Collections;
  3
+using System.Collections.Generic;
8 4
 
9 5
 using NUnit.Framework;
10 6
 
@@ -152,7 +148,7 @@ public void TestValuesAdded()
152 148
             Document d2 = new Document().Append("k1", new Document().Append("k2", new Document().Append("k3", "bar")));
153 149
             AreNotEqual(d1, d2);
154 150
         }
155  
-
  151
+        
156 152
         private void AreEqual(Document d1, Document d2) {
157 153
             if (!d1.Equals(d2)) {
158 154
                 Assert.Fail(string.Format("Documents don't match\r\nExpected: {0}\r\nActual:   {1}", d1, d2));
268  MongoDBDriver/Cursor.cs
@@ -6,214 +6,228 @@
6 6
 
7 7
 namespace MongoDB.Driver
8 8
 {
9  
-	public class Cursor : ICursor {
  9
+    public class Cursor : ICursor
  10
+    {
10 11
         private Connection connection;
11  
-        
  12
+        private ReplyMessage reply;
  13
+
  14
+        #region "Properties"
12 15
         private long id = -1;
13  
-        public long Id{
14  
-            get {return id;}
15  
-        }       
16  
-        
  16
+        public long Id {
  17
+            get { return id; }
  18
+        }
  19
+
17 20
         private String fullCollectionName;
18 21
         public string FullCollectionName {
19  
-            get {return fullCollectionName;}
  22
+            get { return fullCollectionName; }
20 23
         }
21 24
 
22  
-        private Document spec;
23  
-        public ICursor Spec (Document spec){
24  
-            TryModify();
  25
+        private bool modifiable = true;
  26
+        public bool Modifiable {
  27
+            get { return modifiable; }
  28
+        }        
  29
+        #endregion
  30
+
  31
+        public Cursor (Connection conn, string fullCollectionName){
  32
+            this.connection = conn;
  33
+            this.fullCollectionName = fullCollectionName;
  34
+        }
  35
+
  36
+        public Cursor (Connection conn, String fullCollectionName, Document spec, int limit, int skip, Document fields) : this(conn, fullCollectionName){
  37
+            if (spec == null)
  38
+                spec = new Document ();
25 39
             this.spec = spec;
  40
+            this.limit = limit;
  41
+            this.skip = skip;
  42
+            this.fields = fields;
  43
+        }
  44
+
  45
+
  46
+        #region "Fluency"
  47
+        private Document spec;
  48
+        public ICursor Spec (IEnumerable<KeyValuePair<String, Object>> spec){
  49
+            TryModify ();
  50
+            this.spec = EnsureIsDocument(spec);
26 51
             return this;
27 52
         }
28  
-        
  53
+
29 54
         private int limit;
30 55
         public ICursor Limit (int limit){
31  
-            TryModify();
  56
+            TryModify ();
32 57
             this.limit = limit;
33 58
             return this;
34 59
         }
35  
-        
36  
-        private int skip;        
  60
+
  61
+        private int skip;
37 62
         public ICursor Skip (int skip){
38  
-            TryModify();
  63
+            TryModify ();
39 64
             this.skip = skip;
40 65
             return this;
41 66
         }
42  
-        
43  
-        private Document fields;        
44  
-        public ICursor Fields (Document fields){
45  
-            TryModify();
46  
-            this.fields = fields;
  67
+
  68
+        private Document fields;
  69
+        public ICursor Fields (IEnumerable<KeyValuePair<String, Object>> fields){
  70
+            TryModify ();
  71
+            this.fields = EnsureIsDocument(fields);
47 72
             return this;
48 73
         }
49  
-        
  74
+
50 75
         private QueryOptions options;
51  
-        public ICursor Options(QueryOptions options){
52  
-            TryModify();
  76
+        public ICursor Options (QueryOptions options){
  77
+            TryModify ();
53 78
             this.options = options;
54 79
             return this;
55 80
         }
56  
-        
  81
+
57 82
         #region "Spec Options"
58  
-        private Document specOpts = new Document();
59  
-        
60  
-        public ICursor Sort(string field){
61  
-            return this.Sort(field, IndexOrder.Ascending);
  83
+        private Document specOpts = new Document ();
  84
+
  85
+        public ICursor Sort (string field){
  86
+            return this.Sort (field, IndexOrder.Ascending);
62 87
         }
63  
-        
64  
-        public ICursor Sort(string field, IndexOrder order){
65  
-            return this.Sort(new Document().Append(field, order));
  88
+
  89
+        public ICursor Sort (string field, IndexOrder order){
  90
+            return this.Sort (new Document ().Append (field, order));
66 91
         }
67  
-        
68  
-        public ICursor Sort(Document fields){
69  
-            TryModify();
70  
-            AddOrRemoveSpecOpt("$orderby", fields);
  92
+
  93
+        public ICursor Sort (IEnumerable<KeyValuePair<String, Object>> fields){
  94
+            TryModify ();
  95
+            AddOrRemoveSpecOpt ("$orderby", fields);
71 96
             return this;
72 97
         }
73  
-        
74  
-        public ICursor Hint(Document index){
75  
-            TryModify();
76  
-            AddOrRemoveSpecOpt("$hint", index);
  98
+
  99
+        public ICursor Hint (IEnumerable<KeyValuePair<String, Object>> index){
  100
+            TryModify ();
  101
+            AddOrRemoveSpecOpt ("$hint", index);
77 102
             return this;
78 103
         }
79 104
 
80  
-        public ICursor Snapshot(Document index){
81  
-            TryModify();
82  
-            AddOrRemoveSpecOpt("$snapshot", index);
  105
+        public ICursor Snapshot (IEnumerable<KeyValuePair<String, Object>> index){
  106
+            TryModify ();
  107
+            AddOrRemoveSpecOpt ("$snapshot", index);
83 108
             return this;
84 109
         }
85  
-        
86  
-        public Document Explain(){
87  
-            TryModify();
  110
+
  111
+        public Document Explain (){
  112
+            TryModify ();
88 113
             specOpts["$explain"] = true;
89 114
             
90 115
             IEnumerable<Document> docs = this.Documents;
91  
-            using((IDisposable)docs){
92  
-                foreach(Document doc in docs){
  116
+            using ((IDisposable)docs) {
  117
+                foreach (Document doc in docs) {
93 118
                     return doc;
94 119
                 }
95 120
             }
96  
-            throw new InvalidOperationException("Explain failed.");
  121
+            throw new InvalidOperationException ("Explain failed.");
97 122
         }
98 123
 
99 124
         #endregion
100  
-        
101  
-        private bool modifiable = true;
102  
-        public bool Modifiable{
103  
-            get {return modifiable;}
104  
-        }
105  
-        
106  
-        private ReplyMessage reply;
107  
-        
108  
-        public Cursor(Connection conn, string fullCollectionName){
109  
-            this.connection = conn;
110  
-            this.fullCollectionName = fullCollectionName;
111  
-        }
112  
-        
113  
-        public Cursor(Connection conn, String fullCollectionName, Document spec, int limit, int skip, Document fields):
114  
-                this(conn,fullCollectionName){
115  
-            if(spec == null)spec = new Document();
116  
-            this.spec = spec;
117  
-            this.limit = limit;
118  
-            this.skip = skip;
119  
-            this.fields = fields;
120  
-        }
121  
-        
122  
-        public IEnumerable<Document> Documents{
123  
-            get{
124  
-                if(this.reply == null){
125  
-                    RetrieveData();
  125
+        #endregion
  126
+
  127
+        public IEnumerable<Document> Documents {
  128
+            get {
  129
+                if (this.reply == null) {
  130
+                    RetrieveData ();
126 131
                 }
127 132
                 int docsReturned = 0;
128 133
                 Document[] docs = this.reply.Documents;
129 134
                 Boolean shouldBreak = false;
130  
-                while(!shouldBreak){
131  
-                    foreach(Document doc in docs){
132  
-                        if((this.limit == 0) || (this.limit != 0 && docsReturned < this.limit)){
  135
+                while (!shouldBreak) {
  136
+                    foreach (Document doc in docs) {
  137
+                        if ((this.limit == 0) || (this.limit != 0 && docsReturned < this.limit)) {
133 138
                             docsReturned++;
134 139
                             yield return doc;
135  
-                        }else{
  140
+                        } else {
136 141
                             shouldBreak = true;
137 142
                             yield break;
138 143
                         }
139 144
                     }
140  
-                    if(this.Id != 0 && shouldBreak == false){
141  
-                        RetrieveMoreData();                 
  145
+                    if (this.Id != 0 && shouldBreak == false) {
  146
+                        RetrieveMoreData ();
142 147
                         docs = this.reply.Documents;
143  
-                        if(docs == null){
144  
-                            shouldBreak = true; 
  148
+                        if (docs == null) {
  149
+                            shouldBreak = true;
145 150
                         }
146  
-                    }else{
  151
+                    } else {
147 152
                         shouldBreak = true;
148 153
                     }
149 154
                 }
150  
-            }           
  155
+            }
151 156
         }
152  
-        
153  
-        private void RetrieveData(){
154  
-            QueryMessage query = new QueryMessage();
  157
+
  158
+        private void RetrieveData (){
  159
+            QueryMessage query = new QueryMessage ();
155 160
             query.FullCollectionName = this.FullCollectionName;
156  
-            query.Query = BuildSpec();
  161
+            query.Query = BuildSpec ();
157 162
             query.NumberToReturn = this.limit;
158 163
             query.NumberToSkip = this.skip;
159 164
             query.Options = options;
160 165
             
161  
-            if(this.fields != null){
162  
-                query.ReturnFieldSelector = this.fields;
  166
+            if (this.fields != null) {
  167
+                query.ReturnFieldSelector = (Document)this.fields;
163 168
             }
164  
-            try{
165  
-                this.reply = connection.SendTwoWayMessage(query);
  169
+            try {
  170
+                this.reply = connection.SendTwoWayMessage (query);
166 171
                 this.id = this.reply.CursorID;
167  
-                if(this.limit < 0)this.limit = this.limit * -1;
168  
-            }catch(IOException ioe){
169  
-                throw new MongoCommException("Could not read data, communication failure", this.connection,ioe);
  172
+                if (this.limit < 0)
  173
+                    this.limit = this.limit * -1;
  174
+            } catch (IOException ioe) {
  175
+                throw new MongoCommException ("Could not read data, communication failure", this.connection, ioe);
170 176
             }
171  
-
  177
+            
172 178
         }
173  
-        
174  
-        private void RetrieveMoreData(){
175  
-            GetMoreMessage gmm = new GetMoreMessage(this.fullCollectionName, this.Id, this.limit);
176  
-            try{
177  
-                this.reply = connection.SendTwoWayMessage(gmm);
  179
+
  180
+        private void RetrieveMoreData (){
  181
+            GetMoreMessage gmm = new GetMoreMessage (this.fullCollectionName, this.Id, this.limit);
  182
+            try {
  183
+                this.reply = connection.SendTwoWayMessage (gmm);
178 184
                 this.id = this.reply.CursorID;
179  
-            }catch(IOException ioe){
  185
+            } catch (IOException ioe) {
180 186
                 this.id = 0;
181  
-                throw new MongoCommException("Could not read data, communication failure", this.connection,ioe);
  187
+                throw new MongoCommException ("Could not read data, communication failure", this.connection, ioe);
182 188
             }
183 189
         }
184  
-        
185  
-        
186  
-        public void Dispose(){
187  
-            if(this.Id == 0) return; //All server side resources disposed of.
188  
-            KillCursorsMessage kcm = new KillCursorsMessage(this.Id);
189  
-            try{
  190
+
  191
+
  192
+        public void Dispose (){
  193
+            if (this.Id == 0)
  194
+                return;
  195
+            //All server side resources disposed of.
  196
+            KillCursorsMessage kcm = new KillCursorsMessage (this.Id);
  197
+            try {
190 198
                 this.id = 0;
191  
-                connection.SendMessage(kcm);
192  
-            }catch(IOException ioe){
193  
-                throw new MongoCommException("Could not read data, communication failure", this.connection,ioe);
  199
+                connection.SendMessage (kcm);
  200
+            } catch (IOException ioe) {
  201
+                throw new MongoCommException ("Could not read data, communication failure", this.connection, ioe);
194 202
             }
195 203
         }
196  
-        
197  
-        private void TryModify(){
198  
-            if(this.modifiable) return;
199  
-            throw new InvalidOperationException("Cannot modify a cursor that has already returned documents.");
  204
+
  205
+        private void TryModify (){
  206
+            if (this.modifiable)
  207
+                return;
  208
+            throw new InvalidOperationException ("Cannot modify a cursor that has already returned documents.");
200 209
         }
201 210
 
202  
-        private void AddOrRemoveSpecOpt(string key, Document doc){
203  
-            if(doc == null){
204  
-                specOpts.Remove(key);
205  
-            }else{
206  
-                specOpts[key] = doc;
  211
+        private void AddOrRemoveSpecOpt (string key, IEnumerable<KeyValuePair<String, Object>> doc){
  212
+            if (doc == null) {
  213
+                specOpts.Remove (key);
  214
+            } else {
  215
+                specOpts[key] = EnsureIsDocument(doc);
207 216
             }
208 217
         }
209  
-        
210  
-        private Document BuildSpec(){
211  
-            if(this.specOpts.Count == 0) return this.spec;
212  
-            Document doc = new Document();
213  
-            this.specOpts.CopyTo(doc);
  218
+
  219
+        private Document BuildSpec (){
  220
+            if (this.specOpts.Count == 0)
  221
+                return this.spec;
  222
+            Document doc = new Document ();
  223
+            this.specOpts.CopyTo (doc);
214 224
             doc["$query"] = this.spec;
215 225
             return doc;
216 226
         }
217  
-              
  227
+        
  228
+        private Document EnsureIsDocument(IEnumerable<KeyValuePair<string,object>> doc){
  229
+            if(doc is Document) return (Document)doc;
  230
+            return new Document(doc);
  231
+        }
218 232
     }
219 233
 }
154  MongoDBDriver/Document.cs
... ...
@@ -1,135 +1,155 @@
1 1
 using System;
2 2
 using System.Collections;
3  
-using System.Collections.Generic;
4  
-
5  
-namespace MongoDB.Driver {
  3
+using System.Collections.Generic;
  4
+
  5
+namespace MongoDB.Driver
  6
+{
6 7
     /// <summary>
7  
-    /// Description of Document.
  8
+    /// A Document is the base container for an entry inside of a <see cref="Collection/>.
8 9
     /// </summary>
9  
-    public class Document : DictionaryBase {
10  
-        private List<String> orderedKeys = new List<String>();
  10
+    public class Document : IEnumerable<KeyValuePair<String, Object>>
  11
+    {
  12
+        private List<String> orderedKeys = new List<String> ();
  13
+        private Dictionary<String, Object> dictionary = new Dictionary<String, Object>();
11 14
         
  15
+
  16
+        #region "Properties"
12 17
         public Object this[String key] {
13  
-            get {
14  
-                return Dictionary[key];
15  
-            }
  18
+            get { return dictionary[key]; }
16 19
             set {
17  
-                if (orderedKeys.Contains(key) == false) {
18  
-                    orderedKeys.Add(key);
  20
+                if (orderedKeys.Contains (key) == false) {
  21
+                    orderedKeys.Add (key);
19 22
                 }
20  
-                Dictionary[key] = value;
  23
+                dictionary[key] = value;
21 24
             }
22 25
         }
23 26
 
24 27
         public ICollection Keys {
25  
-            get {
26  
-                return (orderedKeys);
27  
-            }
  28
+            get { return (orderedKeys); }
28 29
         }
29 30
 
30 31
         public ICollection Values {
31  
-            get {
32  
-                return (Dictionary.Values);
33  
-            }
  32
+            get { return (dictionary.Values); }
34 33
         }
35 34
 
36  
-        public void Add(String key, Object value) {
37  
-            Dictionary.Add(key, value);
  35
+        public int Count {
  36
+            get { return orderedKeys.Count;}
  37
+        }
  38
+        
  39
+        #endregion
  40
+        
  41
+        #region "Constructors"
  42
+        public Document(){}
  43
+        
  44
+        public Document(string key, object value){
  45
+            this.Add(key, value);
  46
+        }
  47
+        
  48
+        public Document(IEnumerable<KeyValuePair<string,object>> kvps){
  49
+            foreach(KeyValuePair<string,object> kvp in kvps){
  50
+                this.Add(kvp.Key, kvp.Value);
  51
+            }
  52
+        }
  53
+        #endregion
  54
+        
  55
+        public void Add (String key, Object value){
  56
+            dictionary.Add (key, value);
38 57
             //Relies on ArgumentException from above if key already exists.
39  
-            orderedKeys.Add(key);
  58
+            orderedKeys.Add (key);
40 59
         }
41 60
 
42  
-        public Document Append(String key, Object value) {
43  
-            this.Add(key, value);
  61
+        public Document Append (String key, Object value){
  62
+            this.Add (key, value);
44 63
             return this;
45 64
         }
46  
-		
  65
+
47 66
         /// <summary>
48 67
         /// Adds an item to the Document at the specified position
49 68
         /// </summary>
50  
-        public void Insert(String key, Object value, int Position){
51  
-            Dictionary.Add(key, value);
  69
+        public void Insert (String key, Object value, int Position){
  70
+            dictionary.Add (key, value);
52 71
             //Relies on ArgumentException from above if key already exists.
53  
-            orderedKeys.Insert(Position,key);
  72
+            orderedKeys.Insert (Position, key);
54 73
         }
55  
-        public Document Prepend(String key, Object value) {
56  
-            this.Insert(key, value,0);
  74
+        public Document Prepend (String key, Object value){
  75
+            this.Insert (key, value, 0);
57 76
             return this;
58 77
         }
59  
-		
60  
-        public Document Update(Document from) {
61  
-            if (from == null) return this;
62  
-            foreach (String key in from.Keys) {
63  
-                this[key] = from[key];
  78
+
  79
+        public Document Update (Document @from){
  80
+            if (@from == null)
  81
+                return this;
  82
+            foreach (String key in @from.Keys) {
  83
+                this[key] = @from[key];
64 84
             }
65 85
             return this;
66 86
         }
67 87
 
68  
-        public bool Contains(String key) {
69  
-            return (orderedKeys.Contains(key));
  88
+        public bool Contains (String key){
  89
+            return (orderedKeys.Contains (key));
70 90
         }
71 91
 
72  
-        public void Remove(String key) {
73  
-            Dictionary.Remove(key);
74  
-            orderedKeys.Remove(key);
  92
+        public void Remove (String key){
  93
+            dictionary.Remove (key);
  94
+            orderedKeys.Remove (key);
75 95
         }
76 96
 
77  
-        public new void Clear(){
78  
-            Dictionary.Clear();
79  
-            orderedKeys.Clear();
  97
+        public new void Clear (){
  98
+            dictionary.Clear ();
  99
+            orderedKeys.Clear ();
80 100
         }
81 101
 
82 102
         /// <summary>
83 103
         /// TODO Fix any accidental reordering issues.
84 104
         /// </summary>
85 105
         /// <param name="dest"></param>
86  
-        public void CopyTo(Document dest) {
  106
+        public void CopyTo (Document dest){
87 107
             foreach (String key in orderedKeys) {
88  
-                if(dest.Contains(key))
89  
-                    dest.Remove(key);
  108
+                if (dest.Contains (key))
  109
+                    dest.Remove (key);
90 110
                 dest[key] = this[key];
91 111
             }
92 112
         }
93  
-
94  
-        public override bool Equals(object obj) {
  113
+        
  114
+        public override bool Equals (object obj){
95 115
             if (obj is Document) {
96  
-                return Equals(obj as Document);
  116
+                return Equals (obj as Document);
97 117
             }
98  
-            return base.Equals(obj);
  118
+            return base.Equals (obj);
99 119
         }
100 120
 
101  
-        public bool Equals(Document obj) {
  121
+        public bool Equals (Document obj){
102 122
             if (obj == null)
103 123
                 return false;
104 124
             if (orderedKeys.Count != obj.orderedKeys.Count)
105 125
                 return false;
106  
-            return this.GetHashCode() == obj.GetHashCode();
  126
+            return this.GetHashCode () == obj.GetHashCode ();
107 127
         }
108 128
 
109  
-        public override int GetHashCode() {
110  
-
  129
+        public override int GetHashCode (){
  130
+            
111 131
             int hash = 27;
112 132
             foreach (var key in orderedKeys) {
113  
-                var valueHashCode = GetValueHashCode(this[key]);
  133
+                var valueHashCode = GetValueHashCode (this[key]);
114 134
                 unchecked {
115  
-                    hash = (13 * hash) + key.GetHashCode();
  135
+                    hash = (13 * hash) + key.GetHashCode ();
116 136
                     hash = (13 * hash) + valueHashCode;
117 137
                 }
118 138
             }
119 139
             return hash;
120 140
         }
121 141
 
122  
-        private int GetValueHashCode(object value) {
  142
+        private int GetValueHashCode (object value){
123 143
             if (value == null) {
124 144
                 return 0;
125 145
             }
126  
-            return (value is Array) ? GetArrayHashcode((Array)value) : value.GetHashCode();
  146
+            return (value is Array) ? GetArrayHashcode ((Array)value) : value.GetHashCode ();
127 147
         }
128 148
 
129  
-        private int GetArrayHashcode(Array array) {
  149
+        private int GetArrayHashcode (Array array){
130 150
             var hash = 0;
131 151
             foreach (var value in array) {
132  
-                var valueHashCode = GetValueHashCode(value);
  152
+                var valueHashCode = GetValueHashCode (value);
133 153
                 unchecked {
134 154
                     hash = (13 * hash) + valueHashCode;
135 155
                 }
@@ -137,8 +157,20 @@ public class Document : DictionaryBase {
137 157
             return hash;
138 158
         }
139 159
 
140  
-        public override string ToString() {
141  
-            return JsonFormatter.Serialize(this);
  160
+        public override string ToString (){
  161
+            return JsonFormatter.Serialize (this);
142 162
         }
  163
+        
  164
+        
  165
+        public IEnumerator<KeyValuePair<string, object>> GetEnumerator (){
  166
+            foreach(KeyValuePair<string,object> kvp in dictionary){
  167
+                yield return kvp;
  168
+            }
  169
+        }
  170
+        
  171
+        IEnumerator IEnumerable.GetEnumerator (){
  172
+            return GetEnumerator();
  173
+        }
  174
+        
143 175
     }
144 176
 }
10  MongoDBDriver/ICursor.cs
@@ -5,15 +5,15 @@ namespace MongoDB.Driver {
5 5
     public interface ICursor : IDisposable {
6 6
         long Id { get; }
7 7
         string FullCollectionName { get; }
8  
-        ICursor Spec(Document spec);
  8
+        ICursor Spec(IEnumerable<KeyValuePair<String, Object>> spec);
9 9
         ICursor Limit(int limit);
10 10
         ICursor Skip(int skip);
11  
-        ICursor Fields (Document fields);
  11
+        ICursor Fields (IEnumerable<KeyValuePair<String, Object>> fields);
12 12
         ICursor Sort(string field);
13 13
         ICursor Sort(string field, IndexOrder order);
14  
-        ICursor Sort(Document fields);
15  
-        ICursor Hint(Document index);
16  
-        ICursor Snapshot(Document index);
  14
+        ICursor Sort(IEnumerable<KeyValuePair<String, Object>> fields);
  15
+        ICursor Hint(IEnumerable<KeyValuePair<String, Object>> index);
  16
+        ICursor Snapshot(IEnumerable<KeyValuePair<String, Object>> index);
17 17
         Document Explain();
18 18
         bool Modifiable { get; }
19 19
         IEnumerable<Document> Documents { get; }
1  MongoDBDriver/IMongoCollection.cs
@@ -13,6 +13,7 @@ public interface IMongoCollection
13 13
         ICursor FindAll ();
14 14
         ICursor Find (String @where);
15 15
         ICursor Find (Document spec);
  16
+        //ICursor Find (Document spec, Document fields);
16 17
         ICursor Find (Document spec, int limit, int skip);
17 18
         ICursor Find (Document spec, int limit, int skip, Document fields);
18 19
         MapReduce MapReduce ();

0 notes on commit ad2f5da

Please sign in to comment.
Something went wrong with that request. Please try again.