The mongo shell is an interactive JavaScript shell for MongoDB, and is part of all MongoDB distributions. This section provides an introduction to the shell, and outlines key functions, operations, and use of the mongo shell.
Most examples in the MongoDB Manual use the mongo shell; however, many drivers provide similar interfaces to MongoDB.
Is there any way to perform integer arithmetic on two NumberInt or NumberLongs in MongoDB's mapreduce Javascript or in the shell? As you see, I get:
> typeof (NumberInt(1) + NumberInt(1))
number
# (and this is here sort of just to gripe)
>…
I am trying to run the command
mongod --dbpath=data/db
When I get this error:
mongod --dbpath=data/db
[initandlisten] MongoDB starting : pid=10161 port=27017 dbpath=data/db 64-bit host=anr
[initandlisten] db version v2.4.9
…
Based on this SO question and actually this answer I try to update a field on a subdocument.
My code is:
db.venue.find().limit(10).forEach(
function (elem) {
for (var i = elem.events.length - 1; i >= 0; i--) {
…
Short question is on the title: I work with my mongo Shell wich is in safe mode by default, and I want to gain better performance by deactivating this behaviour.
Long Question for those willing to know the context:
I am working on a huge set of data…
I'm trying to aggregate/find data on subdocument that have lists of documents....
I have a mongo document that looks similar to this,
{'town-name': 'anyplace ville',
'locations': {
'sports': [
{'name': 'football world', 'audience':…
I am migrating from server OLD at the old hosting company to server NEW at the new hosting company.
I want to run the clone command so I clone the mongoDB from OLD to NEW.
For OLD:
The public ip address is: 44.55.66.77.
The machine login user name…
my mongod instance is running on a server with Ubuntu 12.10 (x86_64).
From the mongo shell I'm am not able to perform commands like this:
db.listings.update({manName: "Schffer"}, {$set: {manName: "Schäffer"}})
The character 'ä' is not possible to…
I have a mongoDB with dates stored as ms.
when I query the DB with:
> db.drives.find({deviceID:4},{driveDate:1})
I get
{ "_id" : ObjectId("52725be3a3d27f8c9eee4022"), "driveDate" : 1383226033496 }
I want to display this date within the result in…
There are 1 million geo-data in my database and 20% of them are [0,0]
I run the simple query db.test.find({lc:{$near:[0,0]}}), which is extremely slow. It costs about 20~30 seconds because the data will be sorted with $near operation. The CPU usage…
I have the following data on a mongodb:
{
"name" : "bla",
"log" : [
{
"A" : 1,
"B" : 10
},
{
"A" : 2,
"B" : 20
}
]
}
I understand how to return all values…
I've executed the following command in mongo shell:
db.perscoll.insert({CT:{English:{genre:[{name:varGenre}]}}})
Now, i want to find whether genre for 'English' exists in the collection or not using find(), which will return either 0(false) or…
So I have a collections which stores the start and end times for an event and I would like a user to be able to query for events by specifying "filter" start and end times. The query should return any events that intersect with the filter times. I…
Trying to do a proof of concept of loading sample tick data into mongo db and the tick archive data is generally in utc and epoch and need to load it as is and output as utc only not local datetimes.
How to insert utc datetime and epoch in mongodb…
I'm upgrading a sharded cluster and want to turn one of three mongos instance off. I've guaranteed that new incoming connections will not take place because I disabled the box in my load balancer. However, I'm concerned there might be existing…
So I've got an application that uses a lot of embedded documents, which is fine. However I've noticed that some embedded documents aren't displayed when you show collections in Mongo shell.
Normally this isn't an issue, but whilst dicking with…