--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
I think thats the problem. I tried to use my own class named category.
With that class I created a collection with the unique key "Name"
public class Category
{
public string Name { get; set; }
}
Here is the code where I am using it
MongoServer= server;
MongoDatabase DO;
server =MongoServer.Create();
server.Connect();
DO = server.GetDatabase("DO");
MongoCollection<Category> Category = DO.GetCollection<Category>("Category");
var keys = IndexKeys.Ascending("Name");
var options = IndexOptions.SetUnique(true).SetDropDups(true);
Category.CreateIndex(keys, options);
BUT
Category cat = new Category();
Category.Insert(cat);
Category cat = new Category();
Category.Insert(´Test');
works without an exception! How I have to let the driver map my classes to BSON?
I must nerv you again. Look at my small code, waht is wrong? Aftre
settting the unique Index the Category "Eingescannt" should not
created a second time without throwing an exception!
void Start()
{
var connectionString = "mongodb://localhost/?safe=true";
var server = MongoServer.Create(connectionString);
var database = server.GetDatabase("DO");
var collection = database.GetCollection<Category>("Category");
var keys = IndexKeys.Ascending("Name");
var options = IndexOptions.SetUnique(true).SetDropDups(true);
// Wenn es die Kategorie noch nicht gibt diese anlegen
var Category = new Category { Name = "Eingescannt" };
collection.Insert(Category);
var id = Category.Id;
Category = new Category { Name = "Eingescannt" };
collection.Insert(Category);
id = Category.Id;
server.Disconnect();
}
2012/4/24 Michael stupp <michae...@googlemail.com>:
2012/4/25 Robert Stam <rob...@10gen.com>:
Best regards Michael
2012/4/25 Michael stupp <michae...@googlemail.com>:
>> >>> >>> >>>> >>>> mongodb-user+unsubscribe@googlegroups.com.
>> >>> >>> >>>> >>>> For more options, visit this group at
>> >>> >>> >>>> >>>> http://groups.google.com/group/mongodb-user?hl=en.
>> >>> >>> >>>> >>>>
>> >>> >>> >>>> >>>
>> >>> >>> >>>> >>> --
>> >>> >>> >>>> >>> You received this message because you are subscribed to
>> >>> >>> >>>> >>> the
>> >>> >>> >>>> >>> Groups "mongodb-user" group.
>> >>> >>> >>>> >>> To post to this group, send email to
>> >>> >>> >>>> >>> mongod...@googlegroups.com.
>> >>> >>> >>>> >>> To unsubscribe from this group, send email to
>> >>> >>> >>>> >>> mongodb-user+unsubscribe@googlegroups.com.
>> >>> >>> >>>> >>> For more options, visit this group at
>> >>> >>> >>>> >>> http://groups.google.com/group/mongodb-user?hl=en.
>> >>> >>> >>>> >>
>> >>> >>> >>>> >>
>> >>> >>> >>>> >> --
>> >>> >>> >>>> >> You received this message because you are subscribed to
>> >>> >>> >>>> >> the
>> >>> >>> >>>> >> Groups "mongodb-user" group.
>> >>> >>> >>>> >> To post to this group, send email to
>> >>> >>> >>>> >> mongod...@googlegroups.com.
>> >>> >>> >>>> >> To unsubscribe from this group, send email to
>> >>> >>> >>>> >> mongodb-user+unsubscribe@googlegroups.com.
>> >>> >>> >>>> >> For more options, visit this group at
>> >>> >>> >>>> >> http://groups.google.com/group/mongodb-user?hl=en.
>> >>> >>> >>>> >
>> >>> >>> >>>> >
>> >>> >>> >>>> > --
>> >>> >>> >>>> > You received this message because you are subscribed to the
>> >>> >>> >>>> > Groups "mongodb-user" group.
>> >>> >>> >>>> > To post to this group, send email to
>> >>> >>> >>>> > mongod...@googlegroups.com.
>> >>> >>> >>>> > To unsubscribe from this group, send email to
>> >>> >>> >>>> > mongodb-user+unsubscribe@googlegroups.com.
>> >>> >>> >>>> > For more options, visit this group at
>> >>> >>> >>>> > http://groups.google.com/group/mongodb-user?hl=en.
>> >>> >>> >>>>
>> >>> >>> >>>> --
>> >>> >>> >>>> You received this message because you are subscribed to the
>> >>> >>> >>>> Groups
>> >>> >>> >>>> "mongodb-user" group.
>> >>> >>> >>>> To post to this group, send email to
>> >>> >>> >>>> mongod...@googlegroups.com.
>> >>> >>> >>>> To unsubscribe from this group, send email to
>> >>> >>> >>>> mongodb-user+unsubscribe@googlegroups.com.
>> >>> >>> >>>> For more options, visit this group at
>> >>> >>> >>>> http://groups.google.com/group/mongodb-user?hl=en.
>> >>> >>> >>>>
>> >>> >>> >>>
>> >>> >>> >>
>> >>> >>> >> --
>> >>> >>> >> You received this message because you are subscribed to the
>> >>> >>> >> Groups
>> >>> >>> >> "mongodb-user" group.
>> >>> >>> >> To post to this group, send email to
>> >>> >>> >> mongod...@googlegroups.com.
>> >>> >>> >> To unsubscribe from this group, send email to
>> >>> >>> >> mongodb-user+unsubscribe@googlegroups.com.
>> >>> >>> >> For more options, visit this group at
>> >>> >>> >> http://groups.google.com/group/mongodb-user?hl=en.
>> >>> >>>
>> >>> >>> --
>> >>> >>> You received this message because you are subscribed to the Google
>> >>> >>> Groups
>> >>> >>> "mongodb-user" group.
>> >>> >>> To post to this group, send email to
>> >>> >>> mongod...@googlegroups.com.
>> >>> >>> To unsubscribe from this group, send email to
>> >>> >>> mongodb-user+unsubscribe@googlegroups.com.
>> >>> >>> For more options, visit this group at
>> >>> >>> http://groups.google.com/group/mongodb-user?hl=en.
>> >>> >>>
>> >>> >>
>> >>> >> --
>> >>> >> You received this message because you are subscribed to the Google
>> >>> >> Groups
>> >>> >> "mongodb-user" group.
>> >>> >> To post to this group, send email to mongod...@googlegroups.com.
>> >>> >> To unsubscribe from this group, send email to
>> >>> >> mongodb-user+unsubscribe@googlegroups.com.
>> >>> >> For more options, visit this group at
>> >>> >> http://groups.google.com/group/mongodb-user?hl=en.
>> >>>
>> >>> --
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups
>> >>> "mongodb-user" group.
>> >>> To post to this group, send email to mongod...@googlegroups.com.
>> >>> To unsubscribe from this group, send email to
>> >>> For more options, visit this group at
>> >>> http://groups.google.com/group/mongodb-user?hl=en.
>> >>>
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mongodb-user" group.
>> > To post to this group, send email to mongod...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "mongodb-user" group.
>> To post to this group, send email to mongod...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> For more options, visit this group at
>> http://groups.google.com/group/mongodb-user?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to
> For more options, visit this group at
> http://groups.google.com/group/mongodb-user?hl=en.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
I did that. It opens a DOS-BOX and "press enter". No exception.
I resume: I'm testing on a Windows 7 64bit PC with 64bit MongoDB and
32bit C# drivers.
2012/4/25 craiggwilson <craigg...@gmail.com>:
> Would you mind terribly taking the code Robert posted above and running it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/rS63v2SZSmIJ.
>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to
Sure, attached you will find the screenshot.
2012/4/26 craiggwilson <craigg...@gmail.com>:
> Can you launch a shell (mongo.exe) and type in the below commands and let me
> know the output. This will change to the DO database and show the indexes
> that currently exist on the Category collection.
>
> use DO
> db.Category.getIndexes()
>
>
>
> On Wednesday, April 25, 2012 11:28:02 PM UTC-5, Developer wrote:
>>
>> I did that. It opens a DOS-BOX and "press enter". No exception.
>> I resume: I'm testing on a Windows 7 64bit PC with 64bit MongoDB and
>> 32bit C# drivers.
>>
>> 2012/4/25 craiggwilson <craigg...@gmail.com>:
>> > Would you mind terribly taking the code Robert posted above and running
>> > it?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mongodb-user" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/mongodb-user/-/rS63v2SZSmIJ.
>> >
>> > To post to this group, send email to mongod...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/ztBdvwksDggJ.
>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to