This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var server = MongoServer.Create("mongodb://user:[email protected]:29787"); | |
| server.Connect(); | |
| var database = server.GetDatabase("sx_election2012"); | |
| var collection = database.GetCollection<Doc>("moscow"); | |
| //var t = collection.AsQueryable<Doc>().Where(p => p.boundary.Any(s => Regex.IsMatch(s, "", RegexOptions.IgnoreCase))); | |
| var q = Query.Matches("district", BsonRegularExpression.Create(".*центр.*", "i")); | |
| var t = collection.Find(q); | |
| var zzz = t.ToArray(); | |
| var f = t.First(); | |
| var q1 = Query.Near("station.geo", f.geo.ElementAt(0), f.geo.ElementAt(1), 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ((IEnumerable<dynamic>)fr["$and"]).FirstOrDefault(p => p.tags != null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var tagFilter = ((IEnumerable<dynamic>)fr["$and"]).FirstOrDefault(p => p.tags != null); | |
| if (tagFilter != null) | |
| { | |
| var tags = ((IEnumerable<int>)tagFilter.tags["$in"]).Select(p=>(int)p); | |
| q = q.FilterByTags(tags); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #mongo dev/node/tourism/Parsers/_intel/group.js | |
| print "go..." | |
| grps = db.tour.group | |
| key: | |
| dom : true | |
| country : true | |
| initial: | |
| cnt: 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define ["Ural/Modules/ODataFilter", "Ural/Modules/DataFilterOpts", "Ural/Libs/datajs"], (fr, frOpts) -> | |
| class ODataProvider | |
| @serviceHost: -> __g.serviceHost | |
| @_parse: (item, parent)-> | |
| if item == null or item == undefined or item instanceof Date or typeof item != "object" then return item | |
| if item.results and Array.isArray item.results | |
| arr = item.results | |
| if item.d && Array.isArray item.d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.system.namespaces.find({name :/\.tourism\.\w{2,3}\.\d$/}).forEach(function (obj){ | |
| var name = obj.name.replace(/[^.]*\./i, ""); | |
| /* | |
| db[name].ensureIndex({checkin : 1, nights : 1, uprice : 1, stars : 1}); | |
| print(db[name].count()); | |
| */ | |
| db[name].find().forEach(function(obj1){ | |
| db.tourism.full.save(obj1); | |
| } | |
| );} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BACKGROUND O | |
| : O | |
| Ischemic O | |
| heart O | |
| disease O | |
| is O | |
| the O | |
| primary O | |
| cause O | |
| of O |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BACKGROUND O | |
| : O | |
| Ischemic O | |
| heart O | |
| disease O | |
| is O | |
| the O | |
| primary O | |
| cause O | |
| of O |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var connectionString = ConfigurationManager.AppSettings["MONGO_URI"]; | |
| if (connectionString != null) | |
| { | |
| var hostName = Regex.Replace(connectionString, "^(.*)/(.*)$", "$1"); | |
| var dbName = Regex.Replace(connectionString, "^(.*)/(.*)$", "$2"); | |
| var server = MongoServer.Create(hostName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MongoWrapper<T> : IDisposable where T : class | |
| { | |
| public MongoWrapper(string Collection) | |
| { | |
| var connectionString = ConfigurationManager.AppSettings["MONGO_URI"]; | |
| var hostName = Regex.Replace(connectionString, "^(.*)/(.*)$", "$1"); | |
| var dbName = Regex.Replace(connectionString, "^(.*)/(.*)$", "$2"); | |
| _server = MongoServer.Create(hostName); |
OlderNewer