w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Meteor update 0.6.4 -> 0.6.5 , mongo error
I assume you're seeing this in prod? Try deleting .meteorlocaldb*.lock, and if that doesn't work wipe the db by using meteor reset at the console. If that still doesn't work, reply with your exact system specs, filesystem used, mongo binary used on prod, etc.

Categories : Meteor

Meteor without mongo
UPDATE For newer versions of Meteor you need to remove the mongo package. The mongo package is embedded in the meteor-platform package. So you need to remove that and add all the rest back (from https://github.com/meteor/meteor/tree/devel/packages/meteor-platform): meteor remove meteor-platform meteor add meteor webapp logging tracker session ddp blaze spacebars templating check underscore jquery random ejson templating check underscore jquery random ejson Then your app won't use Mongo anymore :). In dev mode you can get rid of mongo by setting the MONGO_URL environment variable to something else and start meteor. For example: MONGO_URL=mongodb://nowhere meteor

Categories : Mongodb

How to sum an array with meteor/mongo
You could use a transform, it might be better to define each document with a name and explicitly defining the points as name/value pair instead of points being the value for each persons name. But this should work: Movies.find({}, {transform: function(doc) { var total_points = 0; var people = doc.score[1]; //Second in array for(point in people) { total_points += people[point] } doc.points = total_points; return doc; }}); This should give you: { title: "Test Movie 2", points: 20, date: [20130808, 20130606], score: [ {"pete": 1, "mary": 1, "simon": 1, "pat": 2, "mike": 0}, {"pete": 5, "mary": 5, "simon": 5, "pat": 0, "mike": 5}] }

Categories : Database

how do you run a mongo shell script with a deployed meteor app?
Get the instance's login details via meteor mongo myapp.meteor.com --url. You'll get something that should match up to mongodb://username:password@host:port/databasename Which you can use to login via mongo on your computer. Be aware the login details last for only 1 minute by which time you need to meteor mongo --url again mongo host:port/databasename -u username -p password yourscript.js

Categories : Javascript

Meteor: Accessing group function of mongo
Meteor doesn't support aggregation directly. To use these other features you need to do it manually. You could use the mongodb-aggregation plugin on atmosphere to do most of the missing stuff. The only thing is that you can't do these types of queries properly on the client (minimongo). You can do them but the query will be relayed to the server with a method call. (Meaning its not reactive) You could reproduce your group query with an aggregation pipeline or a map reduce query. If you want to get some kind of reactive like query on the client you could interpret the data in your handlebars helpers, underscore might be helpful: Template.hello.average = function() { var count; var data = YourCollection.find().map(function(doc) { count++; return doc.mileage;

Categories : Mongodb

How can I recover mongo / minimongo DB data from the browser within a meteor app?
quick and dirty would be something like: console.log(JSON.stringify(YourCollection.find({}).fetch())); that will at least get you the json data for each collection - in theory you can then take that string and reload the database from the client at a later point

Categories : Mongodb

How do you access attributes of an object queried from Mongo in Meteor
find method returns a cursor, not object nor array. To access object, you need to either fetch it from the cursor var skill = Skills.find(Session.get('selected_skill')).fetch()[0]; or get it directly with findOne: var skill = Skills.findOne(Session.get('selected_skill')); Then you may use it just as any other js object: console.log(skill.mana); skill._cache = {cooldown: true};     Keep in mind that on client-side, collection methods like find are non-blocking. They return whatever Meteor has in cache, not necessarily what is in the server-side db. That's why you should always use them in a reactive context, or ensure that all data has been fetched before execution (don't worry about the latter until you're fluent with Meteor, start with the first way). Also, you nee

Categories : Mongodb

How to query mongo using virtual attributes from Collection.transform in meteor
Here's how you would get all "contacts" out of this, perhaps in an inefficient way: var allContacts = []; customers.find().forEach(function(customer){ var contacts = customer.neverContacted(); contacts.forEach(function(contact){ allContacts.push(contact); //You will want to have an if here to check if it already contains that contact already. }); }); Another option: setupSearches(customers.find()).contacts() setupSearches = function(input){ input.contacts = function () { contacts = input.find({customer_id: this._id}).fetch(); return contacts; } return input; }

Categories : Mongodb

Meteor: populate a form select with objects from the mongo collection
I solved this by using the rendered callback: Template.addPage.rendered = function() { Activities.distinct("genre", function(error, result){ result.sort(); var genreList = document.getElementById('genreList'); for(var i in result){ var option=document.createElement("option"); option.text=result[i]; genreList.add(option, null); } }); }

Categories : Meteor

Update document in Meteor mini-mongo without updating server collections
There are some people working on local storage in the browser https://github.com/awwx/meteor-browser-store You might be able to adapt some of their ideas to provide "fake" documents.

Categories : Meteor

Trying to configure meteor with haml and coffeescript and getting error during meteor startup
there are some work arounds as to where you can install NPM packages directly in Meteor . But the standard practice right now is to use Meteorite for packages. I have not found an HTML preprocessor package that did not give me headaches with MEteor, though, so you might be better off sticking with handlebars. Best of luck!

Categories : Meteor

mongo + passenger: right way to reconnect to database from within rails? how to ensure optimal mongo performance?
The method to handle this changed between Mongomapper versions. The correct way now is to use Mongomapper's convenience method in your initializer: MongoMapper.connection.handle_passenger_forking See the source on Github for implementation details.

Categories : Ruby On Rails

Algorithm for mongo objectid filed in mongodb and how to get last 24 hour data from mongo collection
Is there any way to get objectids that are genrated in last 24 hours in mongo collection based on time stamp on objectid You can call JavaScript code such as: date = new Date() date.setDate(date.getDate() - 1) yesterday = Math.floor(date.getTime()/1000).toString(16) db.coll.find({_id : {$gt : new ObjectId(yesterday + "0000000000000000")}} , {_id:1}) The first and second statements are straightforward: yesterday's date. Third row creates a 4-Byte Hex String of yesterday. Which are the 4 leftmost bytes of ObjectId. Then, you pad the 8 rightmost bytes of the ObjectId with zero's as you don't care about those. These are mac address(3), pid(2) and a running counter(3) All you have to now is query your collection (coll in the example) and return the _id's what is the algorithm to

Categories : Mongodb

Mongo C++ Driver: mongo/client/dbclient.h: No such file or directory
The line app/tutorial.cpp:3:35: error: mongo/client/dbclient.h: No such file or directory indicates that g++ is having difficulty finding the installed headers. In the tutorial that you linked to, the box below the suggested compilation command states You may need to use -I and -L to specify the locations of your mongo and boost headers and libraries. I'll assume that the installation procedure placed your header files in /usr/local/include and libraries (e.g. libmongoclient.a) in /usr/local/lib. Then, try adapting the compilation command to read g++ -I/usr/local/include -L/usr/local/lib -pthread -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system app/tutorial.cpp -o tutorial

Categories : C++

Mongo Java finding Maching record in mongo array
We would need to get holistic information about your application in order to tell you if you're making the right modeling decisions; however, I can help you with your current query. In order to match multiple attributes within the same element of an array, you should use the $elemMatch operator (http://docs.mongodb.org/manual/reference/projection/elemMatch/). eg) collection.find({users:{$elemMatch:{username:uname,password:password}}});

Categories : Java

Mongo java maching two or more values in mongo array
Your document structure might get in the way here. How do you distinguish the user logging in? If you get a match, it will return the whole document, with all users. Anyhow, to query with multiple comparisons: BasicDBObject query = new BasicDBObject(); List<BasicDBObject> parts = new ArrayList<BasicDBObject>(); parts.add(new BasicDBObject("users.user_name", uname)); parts.add(new BasicDBObject("users.password", password)); query.put("$and", parts); DBCursor cursor = collection.find(query); while (cursor.hasNext()) { System.out.println(cursor.next()); }

Categories : Java

mongo _id field duplicate key error
Likely, it's because you have an index that requires a unique value for one of the fields as shown below: > db.servers.remove() > db.servers.ensureIndex({"name": 1}, { unique: 1}) > db.servers.insert({"_id": "1.2.3"}) > db.servers.insert({"_id": "1.2.4"}) E11000 duplicate key error index: test.servers.$name_1 dup key: { : null } You can see your indexes using getIndexes() on the collection: > db.servers.getIndexes() [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.servers", "name" : "_id_" }, { "v" : 1, "key" : { "name" : 1 }, "unique" : true, "ns" : "test.servers", "name" : "name_1" } ]

Categories : Mongodb

Update Mongo Collection Using hadoop-mongo & PIG
The solution is to use MongoUpdateStorage: https://github.com/alabid/mongo-hadoop/blob/issues/pig/mongo-update-storage/pig/README.md Works like a charm

Categories : Hadoop

Mongo hadoop mapreduce showing error
If the mapper and reducer don't use the same output types, the mapper key/value types must be specified explicitly - so you probably need to also add: setMapOutputKeyClass(Text.class) setMapOutputValueClass(IntWritable.class)

Categories : Java

Using Mongo Update and $set to insert field (throwing error)
The error you're getting is from Ruby, not MongoDB, because you're trying to use MongoDB's JSON syntax inside of Ruby, which Ruby does not like. :) Your update query looks fine but you need to translate it to Ruby syntax which is a bit different. coll.update( { }, { "$set" => { "tw_handle" => "test" } } ); will work assuming coll is your Collection object. See here for a good tutorial (written by the MongoDB Ruby team) on using the Ruby driver.

Categories : Ruby On Rails

Error in elasticsearch indexing using mongo river and PlainElastic.Net
I found the mistake I was doing In this line of code Dim jsonData As String = serializer.ToJson(data) I am trying to serialized a valid Json Object "data" When I pass "data" instead of "jsonData" in the following line of code Dim indexResult As String = connection.Put(New IndexCommand("_river", "mongodb", "_meta"), jsonData) It's performing the indexing with out any error.

Categories : Mongodb

Mongo command line eval exits without error
I've tried now with MongoDB shell version: 2.2.2 and it works fine: mongo test --eval 'db.things.remove({expires: {$lt: Math.round(new Date().getTime() / 1000)}})' Try to update MongoDB to a newer version if you are not already updated, plus I heard that latests mongoDB version use V8 Javascript engine could be useful

Categories : Bash

Mongo/Mongoose Invalid atomic update value error
I had the same issue. I ended up by using finOne() method create a new one if no found, update the existing one if found. I know there are two operations. but I just haven't find any way to do it in one step.

Categories : Database

Accessing >=2 collections from the same db connection using Mongo-lite results in error
A race condition is giving you the error. The following works for me: var express = require('express'); var app = express(); var http = require('http'); var mongolite = require('mongo-lite'); db = mongolite.connect("mongodb://localhost/fnard", ['col1','col2']); app.use(express.bodyParser()); app.use(app.router); app.get('/', function(request, response){ db.collection('col1').insert({hi:5},function(){ db.collection('col2').insert({hi:5},function(){ console.log(request.body); // your JSON response.send(request.body); // echo the result back }); }); }); http.createServer(app).listen(3000, function () { console.log('Express server listening on port ' + '3000'); }); You need to nest your callbacks. Or, you can use a library like

Categories : Node Js

Error Handling with Spring Data and Mongo Java Driver
This is because you're using the String variant of WriteConcern. That way, your driver regards it to be a replica tags set Write Concern. Hence the exception. Use the int variant for WriteConcern constructor and give it the value of 1 (as in {w=1}) which is the the value for acknowledgment. Anyway, since it's the default Write Concern, you can skip it altogether.

Categories : Java

Exception from setTimeout callback: { stack: [Getter] } and Mongo error
The query inside your Meteor.setTimeout block of code has an $or keyword which contains an empty array. You need to have at least two items in there for your operation. If you're having trouble/using some kind of way to build an $or query you could update your code with this block of code so we could be of further help

Categories : Meteor

Strange Meteor Error
sounds like a bug in the Mesosphere package, get in contact with the creator and mention the error https://github.com/copleykj/Mesosphere

Categories : Meteor

Meteor domutils error
I was having the same problem. For me it occurred when I clicked a link which caused a new template to load. When I added: event.stopImmediatePropagation(); as shown below, the error was corrected. Template.define_blocks.events({ 'click #tb_yes': function(event) { event.preventDefault(); event.stopImmediatePropagation(); });

Categories : Meteor

Meteor 0.6.5 update: underscore error
If you're using an atmosphere (i.e. mrt) package, you may need to downgrade to 0.6.4.1 until the package author has had a chance to update to the new package API that is part of 0.6.5. You can find instructions here - https://groups.google.com/d/topic/meteor-talk/BbrjGcGGIzc/discussion Hope that helps!

Categories : Meteor

Meteor: Could a race condition happen with Meteor.collections on server side?
In Meteor's concurrency model, you can imagine a whole method as an uninterruptible block of stuff that happens. In order for Meteor to switch from running one method midway to say, starting another method, you need to "yield"—the method needs to signal, "I can be interrupted." Methods yield whenever they do something asynchronous, which in practice means any time you do a database update or call a method with a callback in Meteor 0.6.5 and later. Since you give your update call a callback, Meteor will always try to do something in between the call to update and the update's callback. However, in Meteor 0.6.4.2 and earlier, database updates were uninterruptible regardless of the use of callbacks. However, multiple calls to saveOnServer will happen in order and do not cause a race condi

Categories : Javascript

Meteor: meteor-collectionapi PUT overwrites the entire object instead of just updating the field I want
I'm guessing that bash is replacing "$set" with an empty environment variable eg. echo "$set" vs echo "$set" so update your PUT command to: curl -H "X-Auth-Token: 97f0ad9e24ca5e0408a269748d7fe0a0" -X PUT -d "{"$set":{"gender":"Female"}}" http://localhost:3000/collectionapi/players/8BW9Yg2oKByBGdnSa By default Collection.update() will replace a document if no modifiers are present ($set, $unset, $push, $pull etc). So the command being sent to the server is to replace the document with {"":{"gender":"Female"}}

Categories : Api

Meteor Security: should all database insert, update, remove operation be a Meteor.call() to the server?
For the first point, you can choose any of the two possibilities, but i prefer to use the second one : Client can do insert/update/delete Server has some security checks With this system you use the latency compensation of meteor. So it seems to be a good way of doing. For the second point, you can imagine to store in Session where you are on the list when you click on the detail. Then when you come back to the list, you check the session value and you just have to use it to restore the state.

Categories : Javascript

Meteor WebSocket handshake error 400 with nginx
if you are receiving this error client side in the browser console, you can safely ignore it - it means that your hosting does not support websockets and meteor will fallback to using long polling instead meteor apps deployed to heroku or any other platform without websockets will get the same error update: as of meteor v0.6.4 you can now set the environment variable DISABLE_WEBSOCKETS to prevent this attempt from occurring if you know it will fail https://github.com/meteor/meteor/blob/devel/History.md If you set the DISABLE_WEBSOCKETS environment variable, browsers will not attempt to connect to your app using Websockets. Use this if you know your server environment does not properly proxy Websockets to reduce connection startup time.

Categories : Node Js

TB.Socket error with OpenTok WebRTC on Meteor
In typical fashion, after I spend two days on a bug, get so frustrated that I post a question to StackOverflow, and then figure it out an hour later. Long story short, the OpenTok account had an 'enable WebRTC' option that wasn't set. It was an account administrator issue. Long story short... make sure devs have access to the accounts the business folks have!

Categories : Meteor

meteor > error: no such package: 'accounts-urls'
What command did you run before you got the error? If you ran meteor add accounts-ui-bootstrap-dropdown, that won't work. accounts-ui-bootstrap-dropdown is not part of the official packages repository, but it is part of Atmosphere. You have to install the unofficial package manager, Meteorite based on the instructions on the webpage, then you can run mrt add accounts-ui-bootstrap-dropdown EDIT: There is a similar question that is more clear, and you may want to follow this question or confirm that your commands and errors are the same

Categories : Meteor

Meteor: Meteor.call() from within observe callback does not execute
This might be a known issue, i'm not sure since I've not tried it myself, but it looks like there might be a workaround (see https://github.com/meteor/meteor/issues/907) Add your Meteor.call into an instantaneous setTimeout callback: added: function(doc) { console.log("added "+doc.text); setTimeout(function() { Meteor.call('aMethod',doc.text,function(e,r){ if(e){ console.log("error from server: "+e); }else{ console.log("response from server: "+r); } }); },0); }

Categories : Javascript

Code crashed after upgraded from Meteor Windows 0.5.4 to Meteor 0.6.4.1
Since 0.5.4 there have been a couple of changes. The big one being variable scoping. If there is a variable in a file & you want to access that variable from another file you have to scope it globally. i.e if you have var x = true; You have to change it to x = true; The same for a function: function foo() { return "bar"; } //or var foo = function() { return "bar;"} becomes foo = function() { return "bar"; }; You have to go through your files an alter these. Alternatively you could move your files to a new /compatibility directory where they wont be variable scoped.

Categories : Windows

Meteor code must always run within a fiber when deploy in meteor server
You shouldn't need to use Meteor.call on the server side. That is for client-side code only. Just call addQn directly or better yet, inline it since it's just one line of code.

Categories : Mongodb

Installing Meteor-Permission Denied/Run 'meteor update'
Delete all meteor folders In finder (cmd +shft+g) type in "~/.meteor" on the top of the finder window where is has the folder.meteor click and drag folder to trash 2. In finder (cmd +shft+g) type in "/usr/bin/meteor" then drag the meteor folder to trash 3.In /usr/ create a new folder "local" (password required) and inside "local" create a folder "bin" 4. Go back to terminal a run curl install.meteor.com | /bin/sh –

Categories : Meteor

how to export last 15 mins data from mongo collection using mongo export
You can check out this question: mongoDb return results based on time interval You have to escape the spec chars. I could not make it run with the ISODate helper but like this "{date:{$gt:{ "$date" : 1370935140000 }}}" given as a -q parameter to the mongoexport works fine. This case 1370935140000 is the unix timestamp in mili secs. So you have to calculate the unixtimestamp 15 mins before than add 000 at the and and go on with this. I will try to resolve also with the ISODate.

Categories : Mongodb



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.