Example #1
0
        public void TestHashedAscending()
        {
            var    keys     = IndexKeys.Hashed("a").Ascending("b");
            string expected = "{ \"a\" : \"hashed\", \"b\" : 1 }";

            Assert.AreEqual(expected, keys.ToJson());
        }
Example #2
0
        public void TestHashed()
        {
            var    keys     = IndexKeys.Hashed("a");
            string expected = "{ \"a\" : \"hashed\" }";

            Assert.AreEqual(expected, keys.ToJson());
        }
Example #3
0
        private void InitializeConnection(string connectionString)
        {
            var database = MongoDatabase.Create(connectionString);

            _collection = database.GetCollection <User>("users");
            _collection.CreateIndex(IndexKeys <User> .Hashed(index => index.Id));
        }
Example #4
0
        public void TestHashedAscending()
        {
            var keys = IndexKeys <Test> .Hashed(x => x.A).Ascending(x => x.B);

            string expected = "{ \"a\" : \"hashed\", \"b\" : 1 }";

            Assert.Equal(expected, keys.ToJson());
        }
Example #5
0
        public void TestHashed()
        {
            var keys = IndexKeys <Test> .Hashed(x => x.A);

            string expected = "{ \"a\" : \"hashed\" }";

            Assert.Equal(expected, keys.ToJson());
        }
Example #6
0
        public MongoIndexKeysWarpper Hashed(string name)
        {
            if (MongoIndexKeys == null)
            {
                MongoIndexKeys = IndexKeys.Hashed(name);
            }
            else
            {
                MongoIndexKeys = MongoIndexKeys.Hashed(name);
            }

            return(this);
        }