I had hunt with this error: node js mongodb remove error "key $lte must not start with '$'", but that did not helped me.
I am doing following query
coll.remove({ _id : { '$ne' : SomeId }, blah : blaVal });
But that gives the error :
key $ne must not start with '$'
I have started facing this issue, when i migrated mongodb 2.4 to 2.6
My configs are:
nodejs : 0.10
mongodb : 2.6.8 (no issues with 2.4.x)
mongodb driver (npm package version) : 2.1.3 (have tried with 1.4.x and 1.3.x, but error is still there, even emptying node_modules and again `npm install`)
What should I do to resolve the issue?
Related
I'm using react and node js. I want to use Sequelize to manage database with mysql.
So I have this tree with sequelize :
In my package config, I have this :
So when i do :
npm run seed
I want execute the code of sequelize in seed folder.
But I have an error in node console :
How can I correct this error ?
Thank you
I'm getting different responses when inserting documents from Windows and OSX to an external MongoDB database.
Both systems are using mongodb driver v2.1.11 from https://www.npmjs.com/package/mongodb
Inserts are working fine on both but the result I get back is quite different.
OSX: { result: { ok: 1, n: 1, ...other data}, ops: [the inserted records] }
Win: [the inserted records]
Any idea why this is happening?
Steps to reproduce:
nodejs: 5.7.0
npm: 3.6.0
mongodb (from npm): 2.1.11
Given a nodejs application, install v2.1.11 of the official MongoDB driver for nodejs:
npm install --save mongodb#2.1.11.
From your nodejs application, import mongo, create a mongo client and connect to a MongoDB instance and insert a document into a collection:
import mongo from 'mongodb';
const MongoClient = mongo.MongoClient;
MongoClient.connect(mongoUrl, (err, db) => {
db.collection('someCollection').insert({ foo: 'foo'}, (insErr, result) => {
console.log(result); // Observe the result shape is different on Win/OSX
});
});
It turns out there was a package.json buried deep in my application that contains a lower version of the MongoDB driver.
Removing this pacakge.json and ensuring that everything was kept in the top level package.json has solved the problem for me.
db.collection('session').remove({timestamp:{'$lte':a}},function(err, docs) {
console.log(err)
console.log(docs)
});
Version mongodb is 2.6.5, when I make this query from Robomongo visual manager it works normally but from node js it throws error "key $lte must not start with '$'"
I also faced similar issue with some downloaded code- shell worked properly but Node driver failed (there was no other external library like mongoose). My installed MongoDB version was 2.6.6 and the package.json had a mongodb entry as "~1.3.18". With a suggestion from someone, I changed the entry value to "~1.4.31" which resolved my problem.
Remove the quotes around $lte. It is not a key, but a directive.
I have a node.js app running on heroku. I am trying to update my mongodb module to "~2.0.3". In my local dev. environment everything is working fine. However, when I deploy the to Heroku I get a "replicaSet parameter must be set" error which did not fire with earlier version of the mongodb module. I am not how to go about it. In particular, I have no idea where can I find the name of that replicaSet.
Here's a transcript of a node REPL session showing the problem:
$ heroku run node --app my-app
Running `node` attached to terminal... up, run.8299
>var mongo = require('mongodb');
undefined
> var a = {}
undefined
> process.env.MONGOLAB_URI
'mongodb://UUUUU:PPPPP.mongolab.com:45970/heroku_appNNNNNNN'
> mongo.MongoClient.connect(process.env.MONGOLAB_URI, function (err, db) {
a.err = err; a.db = db; console.log('CALLED'); });
undefined
> CALLED
undefined
> a
{ err:
{ [MongoError: replicaSet parameter must be set]
name: 'MongoError',
message: 'replicaSet parameter must be set' },
db: null }
>
One more thing: when I access the DB through the web interface I see only two system collections: system.indexes and system.users. To the best of my understanding this suggests that my DB is not part of a replicaSet which makes the whole thing weird.
This is indeed a problem in 2.0.3. It was solved in 2.0.4 by this pull request.
Bottom line: If you encounter "replicaSet parameter must be set" error in 2.0.3, upgrade to 2.0.4.
I have been using limestone module and Nodejs to query sphinx index. The limestone is out-dated in my npm so i downloaded from github and it is got connected to the sphinx server successfully. But i am now facing the issue as follows,
When i tried to execute the following code,
var limestone = require("limestone").SphinxClient(),
sys = require("sys");
limestone.connect("192.168.2.443:9312", // port. 9312 is standard Sphinx port. also 'host:port' allowed
function(err) {
if (err) {
sys.puts('Connection error: ' + err);
}
sys.puts('Connected, sending query');
limestone.query(
{'query':'raja',maxmatches:1},
function(err, answer) {
if(err){
console.log("Sphinx ERR: "+err);
}else{
console.log(JSON.stringify(answer));
limestone.disconnect();
}
});
});
i got the below error,
Sphinx ERR: Searchd command older than client's version, some options might not workServer issued ERROR: 0bad multi-query count 0 (must be in 1..32 range)
Please help me on this!
Ok, so I installed sphinxseach on Ubuntu, the version in the repository is 0.9.9. I got a similar error as yours:
Searchd command older than client's version, some options might not workServer issued ERROR: Qclient version is higher than daemon version (client is v.1.24, daemon is v.1.22) undefined
After looking through the issues at limestone's github, I figured it was supposed to work with Sphinx version 2. So I installed 2.0.4 from Sphinx download page (they have Ubuntu packages), and it works! So, if it's possible for you to upgrade, that might be a good idea anyway -- and limestone will probably only ever track the latest release.