Linked Questions

79 votes
6 answers
71k views

I have a list of documents, each with lat and lon properties (among others). { 'lat': 1, 'lon': 2, someotherdata [...] } { 'lat': 4, 'lon': 1, someotherdata [...] } [...] I want to modify it so that ...
Pawel Decowski's user avatar
29 votes
3 answers
38k views

I have a collection t1 with the following fields in its schema _id, field1, field1 I want set field2's value field1 like sql: update t1 set field1=field2; How do I do it in MongoDB?
firefox01's user avatar
  • 291
4 votes
1 answer
17k views

I need to run a migration script to insert a value (already available in each document) into an array of this same document. This has to be done for each documents of my collection (no selection query ...
franchez's user avatar
  • 567
1 vote
1 answer
6k views

Consider this schema: var UserSchema = new Schema({ ... user_id: {type:String}, previous_selection: {type:String}, current_selection: {type:String} }); I need to write a function, ...
Mallika Khullar's user avatar
4 votes
1 answer
5k views

I want to set the value of a new field in every document of a "destination" collection, based on the value of a field in documents of another "source" collection. Documents of the destination ...
John Marquez's user avatar
2 votes
2 answers
5k views

I know I can do an update using $set: Contact.update({ _id: request.id }, { $set: { name: newNameValue } }, { upsert: false }, function(err) { ... }); But in this case, instead of passing ...
MarcoS's user avatar
  • 17.8k
1 vote
3 answers
1k views

I am cleaning a dataset, and have a field gender. In this field, there are entries such as Male, male, and MALE. To resolve this, I am trying to update my MongoDB database using pymongo. In the ...
Cassie H.'s user avatar
  • 403
1 vote
1 answer
4k views

I have the DB with names and dates. I need to change the old date with the date that is +3 days after that. For example oldaDate is 01.02.2015 the new one is 03.02.2015. I was trying just to put ...
Josef's user avatar
  • 87
2 votes
1 answer
3k views

I have a collection in MongoDB that contains a list of objects. Each object has an array of "updaters" which are objects with a field that I want to update. One of the updaters in that array needs a ...
konrad's user avatar
  • 3,756
1 vote
1 answer
2k views

I am new to MongoDB and Python thus struggling with something that I'm sure is quite simple to do. In my collection (sample below), I have the date and time stored as a string. I need to convert them ...
khansar's user avatar
  • 11
5 votes
3 answers
2k views

I am new to MongoDB and I would like to ask how to make a new field for the element, which represents for the size of another field in that element. For example: - I have the element such like: { "...
Blurie's user avatar
  • 148
1 vote
1 answer
3k views

I have an inner array as the following: [ {'name': 'foo', 'size': 1}, {'name': 'baz', 'size': 2}, /* ... */ ] I'd like to update some outer field, total which is the sum of all sizes, ...
IsaacLevon's user avatar
  • 2,630
2 votes
0 answers
3k views

For a web application form i'm trying to add data to mongo collection on click of submit. my mongo collection is as below : collection1: { "_id" : ObjectId("56e0a3a2d59feaa43fba49d5"), "timestamp" :...
Rachel's user avatar
  • 247
5 votes
1 answer
1k views

This is a continuation of this question. I'm using the following code to find all documents from collection C_a whose text contains the word StackOverflow and store them in another collection called ...
Aventinus's user avatar
  • 1,412
1 vote
1 answer
1k views

Is it possible to update a field using the value of another field? Here is my schema var timeSchema = new mongoose.Schema({ hours: Number, minutes: Number }); module.exports = mongoose....
Jerome Bravo's user avatar

15 30 50 per page
1
2 3 4 5
12