Permalink
Browse files

Merged in pull request 59 from Justin Dearing to allow passing a Hash…

…table to the constructor of a QueryDocument or an UpdateDocument. Made equivalent changes to the rest of the classes that derive from BsonDocument. These new constructors facilitate creating these objects from Powershell.
  • Loading branch information...
rstam
rstam committed May 11, 2011
1 parent fd66d91 commit 973e87bd2083bdab154d4429e40625a09c4f11c4
@@ -126,7 +126,7 @@ IDictionary dictionary
/// <seealso cref="IDictionary" />
public BsonDocument(
IDictionary dictionary,
IEnumerable<string> keys
IEnumerable keys
)
: base(BsonType.Document) {
Add(dictionary, keys);
@@ -438,7 +438,7 @@ BsonElement element
IDictionary dictionary
) {
if (dictionary != null) {
Add(dictionary, dictionary.Keys.Cast<string>());
Add(dictionary, dictionary.Keys);
}
return this;
}
@@ -451,10 +451,10 @@ IDictionary dictionary
/// <returns>The document (so method calls can be chained).</returns>
public BsonDocument Add(
IDictionary dictionary,
IEnumerable<string> keys
IEnumerable keys
) {
if (dictionary != null) {
foreach (var key in keys) {
foreach (string key in keys) {
Add(key, BsonValue.Create(dictionary[key]));
}
}
@@ -14,6 +14,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -77,6 +78,28 @@ IEnumerable<string> keys
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the CollectionOptionsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public CollectionOptionsDocument(
IDictionary dictionary
)
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the CollectionOptionsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public CollectionOptionsDocument(
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the CollectionOptionsDocument class and adds new elements from a list of elements.
/// </summary>
@@ -14,6 +14,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -77,6 +78,28 @@ IEnumerable<string> keys
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the CommandDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public CommandDocument(
IDictionary dictionary
)
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the CommandDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public CommandDocument(
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the CommandDocument class and adds new elements from a list of elements.
/// </summary>
@@ -14,6 +14,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -77,6 +78,28 @@ IEnumerable<string> keys
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the FieldsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public FieldsDocument(
IDictionary dictionary
)
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the FieldsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public FieldsDocument(
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the FieldsDocument class and adds new elements from a list of elements.
/// </summary>
@@ -14,6 +14,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -77,6 +78,28 @@ IEnumerable<string> keys
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the GeoNearOptionsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public GeoNearOptionsDocument(
IDictionary dictionary
)
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the GeoNearOptionsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public GeoNearOptionsDocument(
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the GeoNearOptionsDocument class and adds new elements from a list of elements.
/// </summary>
@@ -14,6 +14,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -77,6 +78,28 @@ IEnumerable<string> keys
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the GroupByDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public GroupByDocument(
IDictionary dictionary
)
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the GroupByDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public GroupByDocument(
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the GroupByDocument class and adds new elements from a list of elements.
/// </summary>
@@ -14,6 +14,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -77,6 +78,28 @@ IEnumerable<string> keys
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the IndexKeysDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public IndexKeysDocument(
IDictionary dictionary
)
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the IndexKeysDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public IndexKeysDocument(
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the IndexKeysDocument class and adds new elements from a list of elements.
/// </summary>
@@ -14,6 +14,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -77,6 +78,28 @@ IEnumerable<string> keys
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the IndexOptionsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public IndexOptionsDocument(
IDictionary dictionary
)
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the IndexOptionsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public IndexOptionsDocument(
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the IndexOptionsDocument class and adds new elements from a list of elements.
/// </summary>
@@ -14,6 +14,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -77,6 +78,28 @@ IEnumerable<string> keys
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the MapReduceOptionsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public MapReduceOptionsDocument(
IDictionary dictionary
)
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the MapReduceOptionsDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public MapReduceOptionsDocument(
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the MapReduceOptionsDocument class and adds new elements from a list of elements.
/// </summary>
@@ -57,22 +57,33 @@ BsonElement element
}
/// <summary>
/// Initializes a new instance of the QueryDocument class and adds new elements from an <see cref="IDictionary">IDictionary</see>.
/// Initializes a new instance of the QueryDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public QueryDocument(
IDictionary dictionary
IDictionary<string, object> dictionary
)
: base(dictionary)
{
: base(dictionary) {
}
/// <summary>
/// Initializes a new instance of the QueryDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public QueryDocument(
IDictionary<string, object> dictionary
IDictionary<string, object> dictionary,
IEnumerable<string> keys
)
: base(dictionary, keys) {
}
/// <summary>
/// Initializes a new instance of the QueryDocument class and adds new elements from a dictionary of key/value pairs.
/// </summary>
/// <param name="dictionary">A dictionary to initialize the document from.</param>
public QueryDocument(
IDictionary dictionary
)
: base(dictionary) {
}
@@ -83,8 +94,8 @@ IDictionary dictionary
/// <param name="dictionary">A dictionary to initialize the document from.</param>
/// <param name="keys">A list of keys to select values from the dictionary.</param>
public QueryDocument(
IDictionary<string, object> dictionary,
IEnumerable<string> keys
IDictionary dictionary,
IEnumerable keys
)
: base(dictionary, keys) {
}
Oops, something went wrong.

0 comments on commit 973e87b

Please sign in to comment.