Questions tagged [findandmodify]
96 questions
0
votes
1 answer
Mongo DB findAndModify query
JSON Object:
{
"_id" : ObjectId("123"),
"pi" : [
{
"si" : 0,
"ui" : {
"_id" : ObjectId("xyz"),
"un" : "xyz",
"his" : 27,
}
},
{
…

Jay Jariwala
- 185
- 2
- 10
0
votes
0 answers
in batch copy the file name but not file extention
So i am converting excel files into a .txt files using vbs, and the input file name needs to be the same as the output file name with the changed file extension obviously. Whats making this so hard is the fact that I using this as basically a file…

Sonican
- 27
- 1
- 2
0
votes
2 answers
Compare user input with values stored in vector
This is my program thus far. It compiles but gets stuck and crashes on the last part. I want to repeat user's string input and replace any bad words found in the string with "****". Most likely my error is in find_Poop_inSentence. "Debug Assertion…

Ranfan
- 53
- 8
0
votes
1 answer
How to write these queries in spring repository abstraction format
1.
Consider I have a class which has a Map
public class MobileToken
{
@Id
private String _id;
@Indexed
private String username;
private String applicationId;
private…

user1211
- 1,507
- 1
- 18
- 27
0
votes
1 answer
Mongodb get unique value from documents and add to array
I wanted to do a query to match documents in one collection with documents in another collection based upon a value which should be contained in both sets of documents but, as I have been informed that Mongo does not support a JOIN, I believe I…

Matt Lightbourn
- 597
- 3
- 20
0
votes
1 answer
Select documents in one collection where an ID matches in another collection
I'm trying to do a status update to a set of records in one collection where an ID exists in a different collection.
I cannot think how you would construct such a query, I believe I would add it into a finaAndModify function as shown below.
The…

Matt Lightbourn
- 597
- 3
- 20
0
votes
0 answers
Replacing value in xml with another string batch script
I am new to batch scripting and I have gone through loads of posts on SO to find an answer but nothing seems to work for me. I am trying to read a xml file and extract few values and then find a string in same xml and replace with a new string I…

Abhilasha
- 929
- 1
- 17
- 37
0
votes
2 answers
str_replace() not working for the following case
I would like to use str_replace() to place span elements around html strings for the purpose of highlighting them.
However the following does not work when there is inside the string. I've tried replacing the with ' ' but this did not…

user3857924
- 86
- 3
- 15
0
votes
1 answer
Python/R : If 2 columns have same value in multiple rows, add the values in the 3rd column and average the 4th, 5th and 6th column
Input :
0 77 1 2 3 5
0 78 2 4 6 1
0 78 1 2 3 5
3 79 0 4 5 2
3 79 6 8 2 1
3 79 1 2 3 1
Output : (add the 3rd column values for the identical rows and take mean of all the values in the 4th, 5th and the 6th column)
0 77 1.0 2.0 3.0 5.0
0 78 3.0 3.0…

akaur
- 389
- 1
- 6
- 22
0
votes
1 answer
nodejs driver for mongodb fndAndModify
I have the following code:
var conditions = {_id: playerID, 'gameStats.GameID' : gameID},
update = {$inc: {'gameStats.$.wins' : 1}},
options = {new : true};
player.findAndModify(conditions, update, options, function (err, doc) {
if…

Kevin Debono
- 3
- 1
0
votes
3 answers
How do I upsert a mongo (or spring-mongo) document containing a list
I'm trying determine if there is a way using spring-mongodb (or even using the mongo java API), to upsert a document containing a list such that the elements of the list are always a union of the values upserted.
Suppose I have the following…

kfb.dev.work
- 1
- 1
0
votes
1 answer
Is there a way to get only the found document as the result of findAndModify without the wrapping info
I have a findAndModify MongoDb request. The mongo server wraps the document in:
{
value: { ... },
lastErrorObject: { updatedExisting: true, n: 1 },
ok: 1
}
is there a way to only get the object from the value key?
{ ... }

Gabriel Petrovay
- 20,476
- 22
- 97
- 168
0
votes
1 answer
Increment Dictionary Value in MongoDB C# Driver
I have the following object:
[BsonId]
public ObjectId Id { get; set; }
public string Area { get; set; }
public DateTime Date { get; set; }
public int MethodCalls { get; set; }
public Dictionary Actions { get; set; }
The…

Gaz
- 1,249
- 3
- 19
- 37
0
votes
1 answer
Yet another MongoDB findAndModify
Please consider the following document, a part of the Runtime collection:
{
"entity_id" : 10,
"features" : [
{
"10" : "Test System 2"
},
{
"20" : "System 2 Description"
},
{
"180" :…

Alex
- 210
- 2
- 13
0
votes
2 answers
SED (or other find and replace); altering embedded tags
I have many instances following this format in .xml file:
"good B data"
"more good B data"
"some data"
…

David Lemporo
- 91
- 10