Search Results

Search found 1015 results on 41 pages for 'mongodb csharp'.

Page 16/41 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • how get validation messages from mangomapper using rails console ?

    - by Alex
    Hi, I am basically teaching myself how to use RoR and MongoDB at the same time. I am following the very good book / tutorial : http://railstutorial.org/ I decided to replace Sqlite3 by MongoDB using the mongomapper gem. Everything works out about alright, but I am having some non-blocking little issues that I truly wish I could get rid of. In chapter 6, when working with validation I got 2 issues: - I don't know how to get the validations messages back like with Sqlite3. The "standard" code is: $ rails console --sandbox >> user = User.new(:name => "", :email => "[email protected]") >> user.save => false >> user.valid? => false >> user.errors.full_messages => ["Name can't be blank"] but if I try to do the same with MongoMapper, it throws an error saying that errors is undefined function. So does it mean that this is simply not implemented in mongomapper / mongo driver ? Or is there some other clever way to do this that I could not figure ? Additional, 2 things here: - I following the exemple in the book to the line, so I was expecting to be able to use the console in sandbox mode, but apparently that does not work either: (...)ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/console/sandbox.rb:1:in `<top (required)>': uninitialized constant ActiveRecord (NameError) from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/application.rb:226:in `initialize_console' from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/application.rb:153:in `load_console' from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/commands/console.rb:26:in `start' from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start' from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>' Also, in the book they call "user" but I need to call "User" (note the capital U) why is that ? Is it like mangomapper does not follow the Ruby naming convention or something ? And finally, I am trying to validate the field email with a regex as shown in the tutorial. It does not throws any errors at the code, but whenever I try to insert it just won't ever accept it unless I comment out the :format option... class User include MongoMapper::Document key :name, String, :required => true, :length => { :maximum => 50 } key :email, String, :required => true, # :format => { :with => email_regex }, :uniqueness => { :case_sentitive => false} timestamps! end Any advices you can provide on those topics would help me a lot ! Thanks, Alex

    Read the article

  • Drop in solution for logging to DB

    - by Jake
    I'm considering setting up our servers to log to a Mongo Database rather than log files. Logs will then be all on one server, queryable, and overall easier to manage. I'd love to find a solution that will allow all the different processes I have running to write to DB rather than files (or perhaps something to read the files, pass the logs on and truncate the files). I don't want to have to find a different solution for every process if I can avoid it. So, does anyone know of an existing solution to this problem?

    Read the article

  • mongoexport csv output array values

    - by 9point6
    I'm using mongoexport to export some collections into CSV files, however when I try to target fields which are members of an array I cannot get it to export correctly. command I'm using: mongoexport -d db -c collection -fieldFile fields.txt --csv > out.csv and the contents of fields.txt is similar to id name address[0].line1 address[0].line2 address[0].city address[0].country address[0].postcode where the BSON data would be: { "id": 1, "name": "example", "address": [ { "line1": "flat 123", "line2": "123 Fake St.", "city": "London", "country": "England", "postcode": "N1 1AA" } ] } what is the correct syntax for exporting the contents of an array?

    Read the article

  • Understanding mongod log entries

    - by Jo Erlang
    Can anyone explain the numbers in the % column, in this mongod log snippet ? It is building a new index but I'm not sure I understand why the numbers look like that Tue Nov 20 11:38:08 [initandlisten] connection accepted from 127.0.0.1:49299 #8 (2 connections now open) Tue Nov 20 11:38:08 [conn8] build index xx.yyyy { source: 1 } Tue Nov 20 11:38:19 [conn8] 2921300/243339 1200% Tue Nov 20 11:38:29 [conn8] 4109600/243339 1688% Tue Nov 20 11:38:39 [conn8] 4400100/243339 1808% Tue Nov 20 11:38:49 [conn8] 4676600/243339 1921% Tue Nov 20 11:38:59 [conn8] 4939700/243339 2029% Tue Nov 20 11:39:09 [conn8] 5217800/243339 2144% Tue Nov 20 11:39:19 [conn8] 5439300/243339 2235% Tue Nov 20 11:39:29 [conn8] 5659700/243339 2325% Thanks

    Read the article

  • Database OR Array

    - by rezoner
    What is the exact point of using external database system if I have simple relations (95% querries are dependant on ID). I am storing users and their stats. Why would I use external database if I can have neat constructions like: db.users[32] = something Array of 500K users is not that big effort for RAM Pros are: no problematic asynchronity (instant results) easy export/import dealing with database like with a native object LITERALLY ps. and considerations: Would it be faster or slower to do collection[3] than db.query("select ... I am going to store it as a file/s There is only ONE application/process accessing this data, and the code is executed line by line - please don't elaborate about locking. Please don't answer with database propositions but why to use external DB over native array/object - I have experience in a few databases - that's not the case. What I am building is a client/gateway/server(s) game. Gateway deals with all users data, processing, authenticating, writing statistics e.t.c No other part of software needs to access directly to this data/database.

    Read the article

  • So how does one use rockmongo to connect to a mongo sharded setup with replicasets?

    - by Tom
    I try to use rockmongo, to connect to our cluster. Our setup is a setup of two shards each consisting of a replicaset. I try to connect to the mongos instance and while rockmongo connects I get an error when trying to list the dbs: Execute failed:not master function (){ return db.getCollectionNames(); } This has something to do with the replica sets and everybody points to: $MONGO["servers"][$i] = array("replicaSet" => "xxxxx"); This is all fine, but I have two replicasets and as far as I understand I should connect to the mongos instance and not directly to the members of the set. So how does one use rockmongo to connect to a mongo sharded setup with replicasets?

    Read the article

  • Mongo daemon restarts after replica set issue

    - by Matt Beckman
    We had a recent election in our replica set (2 read nodes; 1 write node) that changed the primary node. Curious as to why this occurred, I started looking through the logs to find out what happened. It appears that mongoNode2 could not communicate with mongoNode3. When both nodes could not communicate, it appears that this caused the services on mongoNode2 and mongoNode3 to restart, eventually resulting in a new primary after the services had been started again. Thu Jun 23 08:27:28 [ReplSetHealthPollTask] DBClientCursor::init call() failed Thu Jun 23 08:27:28 [ReplSetHealthPollTask] replSet info mongoNode3:27017 is down (or \ slow to respond): DBClientBase::findOne: transport error: mongoNode3:27017 query: { \ replSetHeartbeat: "myReplSet", v: 3, pv: 1, checkEmpty: false, from: \ "mongoNode2:27017" } Thu Jun 23 08:27:29 got kill or ctrl c or hup signal 15 (Terminated), will \ terminate after current cmd ends Thu Jun 23 08:27:29 [interruptThread] now exiting Thu Jun 23 08:27:29 dbexit: Is there any reason that the mongo service would restart due to a DBClientCursor::init call() failure? Is this a known bug? It should be noted that mongoNode2 and mongoNode3 are VMs on the same VMware host. MongoNode1 is not on the same host, and it did not have any issues with the service. However, I did not have any other reports of issues with other VMs on the VMware host.

    Read the article

  • mongod fork vs nohup

    - by Daniel Kitachewsky
    I'm currently writing process management software. One package we use is mongo. Is there any difference between launching mongo with mongod --fork --logpath=/my/path/mongo.log and nohup mongod >> /my/path/mongo.log 2>&1 < /dev/null & ? My first thought was that --fork could spawn more processes and/or threads, and I was suggested that --fork could be useful for changing the effective user (downgrading privileges). But we run all under the same user (process manager and mongod), so is there any other difference? Thank you

    Read the article

  • Mongo Scripting the shell

    - by cKendrick
    On my production stack, I have a front-end server and a Mongo server. I would like to be able to set a cron job on the front-end server to create some logs daily. I wrote a script that does this: ./mongo server:27017/dbname --quiet my_commands.js If I run it from the Mongo server as above, it works fine. However, I would like to be able to run it from the front-end server. When I try to do that, I get: -bash: mongo: command not found Since mongo is not installed on the front end server, it gives me that error. Is it possible to somehow bind mongo to my mongo on the Mongo server?

    Read the article

  • Rename Mongo Shard

    - by HeySteve
    Can I, and if I can, how can I rename a shard in Mongo? Like if I wanted to change the instances of rs0 to rep0 below: mongos> sh.status() --- Sharding Status --- sharding version: { "_id" : 1, "version" : 4, "minCompatibleVersion" : 4, "currentVersion" : 5, "clusterId" : ObjectId("111111111111") } shards: { "_id" : "rs0", "host" : "rs0/mongo0a:27017,mongo0b:27017" } ... I have thought about removing and re-adding the shard, but I'm not sure how I'd do that without having to drain the shard and drop dbs. Currently 0 of the collections have sharding enabled, I just have a few standalones added as shards. Thanks

    Read the article

  • Is it possible to run multiple mongod instances on a single set of database files

    - by 9point6
    We have large multi-gigabyte data sets on which we run very complex queries, for example { $or: [ { id: 30000001, ... }, { id: 30000005, ... }, ..., { id: 30001005, ... } ] } It seems that CPU is actually a bottleneck at this point, so I'd be advantageous to be able to run multiple mongod instances on the same set of database files. We've considered using replica sets to this end, but would prefer to not require the extra disk space simply for CPU reasons.

    Read the article

  • Mongo Map Reduce first time

    - by James
    Hello guys, First time Map/Reduce user here, and using MongoDB. I have a lot of page visit data which I'd like to make some sense of by using Map/Reduce. Below is basically what I want to do, but as a total beginner a Map/Reduce, I think this is above my knowledge! Find all visits to current page where external = true within the last 30 days (unix timestamp, I deal with the date ranges in PHP and then the array, not mongo date) Group all visits by referral location For each referral location, calculate how many then went to visit a page which has a certain word in the [tags]. I'm using the normal Mongo PHP extension if that has an impact.

    Read the article

  • NodeJS and node-mongodb-native

    - by w1nk
    Just getting started with node, and trying to get the mongo driver to work. I've got my connection set up, and oddly I can insert things just fine, however calling find on a collection produces craziness. var db = new mongo.Db('things', new mongo.Server('192.168.2.6',mongo.Connection.DEFAULT_PORT, {}), {}); db.open(function(err, db) { db.collection('things', function(err, collection) { // collection.insert(row); collection.find({}, null, function(err, cursor) { cursor.each(function(err, doc) { sys.puts(sys.inspect(doc,true)); }); }); }); }); If I uncomment the insert and comment out the find, it works a treat. The inverse unfortunately doesn't hold, I receive this error: collection.find({}, null, function(err, cursor) { ^ TypeError: Cannot call method 'find' of null I'm sure I'm doing something silly, but for the life of me I can't find it...

    Read the article

  • Are document-oriented databases meant to replace relational databases?

    - by evolve
    Recently I've been working a little with MongoDB and I have to say I really like it. However it is a completely different type of database then I am used. I've noticed that it is most definitely better for certain types of data, however for heavily normalized databases it might not be the best choice. It appears to me however that it can completely take the place of just about any relational database you may have and in most cases perform better, which is mind boggling. This leads me to ask a few questions: Are document-oriented databases have been developed to be the next generation of databases and basically replace relational databases completely? Is it possible that projects would be better off using both a document-oriented database and a relational database side by side for various data which is better suited for one or the other? If document-oriented databases are not meant to replace relational databases, then does anyone have an example of a database structure which would absolutely be better off in a relational database (or vice-versa)?

    Read the article

  • NO-SQL reliable for small bussines app?

    - by mamcx
    I'm deciding between go for a NON-SQL engine or a regular SQL one for a document managment system for small bussines. I have experience with firebird/sql server and found a good track of reliability (specially with firebird). This market is full of crappy "servers" (clon-made PC, the mayority), cheap harddisk, rarely use of RAID or anything like that, some are in locations where a power-off is normal, some not have a UPS, etc... (I will include off-site auto-backup to external servers, but that no change the internal setup). (I know about end-user education about such proper setups, but is stupid depend on that, so stick to te point) From the desing point of view, a schema-less database is the way to go for my system, but, I worry if any of the actual solutions (MongoDb, Tokyo Cabinet, etc) are like firebird and survice crash, malfunctions & abuse so data corruption is very rare. The plan is store the office documents there & provide a central repository.

    Read the article

  • Is it bad practice to extend the MongoEngine User document?

    - by Soviut
    I'm integrating MongoDB using MongoEngine. It provides auth and session support that a standard pymongo setup would lack. In regular django auth, it's considered bad practice to extend the User model since there's no guarantee it will be used correctly everywhere. Is this the case with mongoengine.django.auth? If it is considered bad practice, what is the best way to attach a separate user profile? Django has mechanisms for specifying an AUTH_PROFILE_MODULE. Is this supported in MongoEngine as well, or should I be manually doing the lookup?

    Read the article

  • Pros and cons of ways of storing an unsigned int without an unsigned int data type

    - by fields
    I have values that are 64-bit unsigned ints, and I need to store them in mongodb, which has no unsigned int type. I see three main possibilities for storing them in other field types, and converting on going in and out: Using a signed int is probably easiest and most space efficient, but has the disadvantage that they're not human readable and if someone forgets to do the conversion, some of them will work, which may obscure errors. Raw binary is probably most difficult for inexperienced programmers to deal with, and also suffers from non-human-readability. A string representation is the least space efficient (~40 bytes in unicode vs 8 bytes per field), but then at least all of the possible values will map properly, and for querying only a conversion to string is required instead of a more complicated conversion. I need these values to be available from different platforms, so a single driver-specific solution isn't an option. Any major pros and cons I've missed? Which one would you use?

    Read the article

  • Can DBRefs contain additional fields?

    - by Soviut
    I've encountered several situations when using MongoDB that require the use of DBRefs. However, I'd also like to cache some fields from the referenced document in the DBRef itself. {$ref:'user', $id:'10285102912A', username:'Soviut'} For example, I may want to have the username available even though the user document is referenced. This would provide me all the benefits of a single document approach; Faster querying and eliminating the need to do manual dereferencing in my code. While at the same time allowing me to use references where they make sense. The idea being that when the referenced document is updated (a user changes their name, for example) my business layer can automatically update all the documents that reference it. Ultimately, I'm wondering if it's considered good form to store additional fields on my DBRefs? Will it break anything? Will I lose my data each time a reference is rewritten? Will drivers like pymongo support it?

    Read the article

  • Apply limit in mapreduce function in php?

    - by Rohan Kumar
    How to apply limit in php, mongodb when using mapreduce function? I tried this $cmd=array(// codition array "mapreduce" => "user", "map" => $map, "reduce" => $reduce, "out" => array("inline" => 1), "limit"=>2 ); $db=connect(); $query = $db->command($cmd);// run command But its not working it gives 2 documents.I can't use limit on sub documents. If I have 100's of sub documents and then I want paging in sub documents.Then it fails.Is it possible to apply limit on sub documents?

    Read the article

  • Advice on e-commerce logging strategy

    - by yalestar
    I recently inherited an e-commerce app (Java/Struts) that I'm porting to Rails. The thing is, we frequently have to do forensics on orders by poring through the log files, and with the old app's logs (log4j wall of text) it's pretty hard to make sense of the individual orders when several people are placing orders simultaneously. So I'm soliciting advice on a good strategy for logging of these orders, like maybe logging each individual order to its own MongoDB collection based on unique cart ID? Or maybe group them by IP address? Something different entirely? Essentially, what is the best approach for logging of an online store so that it's easy to backtrace each user's interaction with the site?

    Read the article

  • Get a list of documents from Mongo DB

    - by Andrei Neagu
    Hello, I want to do something like this: List<int> fff = new List<int>(); fff.Add(1); fff.Add(2); fff.Add(5); Mongo m = new Mongo(); m.Connect(); var dataBase = m.GetDatabase("database"); var collection = dataBase.GetCollection("coll"); IMongoQuery queryable = collection.AsQueryable(); MongoQueryProvider prov = new MongoQueryProvider(collection); var query = new MongoQuery(prov); var ffppp = from p221 in query where fff.Contains((int)p221["oid"]) select p221; This throws this error : The method 'Contains' could not be converted into a constant. I saw that mongo has an operator $in. Does any one know how can I use it from c#? (http://www.mongodb.org/display/DOCS/Advanced+Queries) Thanks

    Read the article

  • What are good hosting companies for PHP 5.3 Mysql / CouchDb / MongoDB Dev ( Lithium / CakePHP Framew

    - by Abba Bryant
    I am looking for a quality reliable host for some lithium development. I don't mind a shared platform as long as I have some ssh access. I require php 5.3.x, Mysql 5.x, and the usual imageMagick etc. Non-relational DB support up front would be nice but if they let me set one up myself I would be okay with doing it. I don't need a lot in the way of control panel tools. Good ones are appreciated but bad ones I would prefer not to even deal with. I don't anticipate needing much in the way of email but mail support would be nice to have. Cost isn't a big issue. I don't want to pay an arm and a leg but don't mind paying for what I need. Good support and decent uptime would be nice but I don't need an SLO or anything.

    Read the article

  • mongoid with rails - Database should be a Mongo::DB, not NilClass"

    - by Adam T
    Greetings I am trying to get Mongoid to work with my Rails app and I am getting an error: "Mongoid::Errors::InvalidDatabase in 'Shipment bol should be unique' Database should be a Mongo::DB, not NilClass" I have created the mongoid.yml file in my config directory and have mongodb running as a daemon. The config file is like so: defaults: &defaults host: localhost development: <<: *defaults database: ship-it-development test: <<: *defaults database: ship-it-test production: <<: *defaults host: <%= ENV['MONGOID_HOST'] % port: <%= ENV['MONGOID_PORT'] % database: <%= ENV['MONGOID_DATABASE'] % All of my specs fail with the above error. I am using rails 2.3.8. Anyone have ideas?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >