mongodb-query Questions
2
Solved
I am looking to do the equivalent of $setIsSubset http://docs.mongodb.org/manual/reference/operator/aggregation/setIsSubset/ for regular (i.e. NOT aggregate) queries in MongoDB. How can I do this?
...
Gunilla asked 2/3, 2015 at 20:59
2
Solved
Does anyone know how to add an array element to a mongodb array and set a "virtual" order to the size of the array, all in an atomic operation?
So, something like:
db.users.updateOne(
{ ...
Anatropous asked 4/8 at 7:19
2
I have a collection of messages which stores the following information
code: a unique identification code of the message
from: phone number the message was sent from
to: phone number the message w...
Huai asked 21/9, 2017 at 8:37
3
I am using Mongo 3.2.14
I have a mongo collection that looks like this:
{
'_id':...
'field1':...
'field2':...
'field3':...
etc...
}
I want to aggregate this way:
db.collection.aggregate{
'$ma...
Rodrigorodrigue asked 15/8, 2017 at 0:43
3
Solved
I want to push some values into array using Python.
Maybe next time when i update the array ,it will insert some values exists ,so it will got some duplicate values.
I want to know is there anyway ...
Chew asked 9/4, 2016 at 15:10
7
Solved
I want to show products by ids (56e641d4864e5b780bb992c6 and 56e65504a323ee0812e511f2) and show price after subtracted by discount if available.
I can count the final price using aggregate, but th...
Riobard asked 24/3, 2016 at 4:27
3
Solved
So, i'm trying to delete a document when a button is pressed. The button code looks like this:
<form action="/patients/delete?_method=DELETE" method="POST">
<input typ...
Oviduct asked 30/7, 2020 at 15:27
7
I have my ISODate in mongo as ISODate and I want to just that in string format with a specific datetime format.
Here is the ISODate:
ISODate("2020-04-24T11:41:47.280Z")
Expected Result:
"2020-...
Ratite asked 19/12, 2014 at 5:46
5
Solved
We are working on a project to get data from mongoDB. We have created repository class as below
@Repository
public interface CustomerRepository extends MongoRepository<Customer,String>{
List...
Batchelor asked 15/4, 2022 at 17:23
6
Solved
I have a device collection.
{
"_id" : "10-100-5675234",
"_type" : "Device",
"alias" : "new Alias name",
"claimCode" : "FG755DF8N",
"hardwareId" : "SERAIL02",
"isClaimed" : "true",
"model"...
Kahaleel asked 1/4, 2015 at 11:37
3
I am using MongoDB Atlas cloud(https://cloud.mongodb.com/) and Mongoose library.
I tried to create multiple documents using transaction concept, but it is not working.
I am not getting any error. ...
Trichloride asked 22/11, 2018 at 17:8
4
Solved
In reservation system, only 5 different user can create bookings. If 100 user call booking api at same time than how to handle concurrency with locking. I am using nodejs with mongodb. I went throu...
Rriocard asked 18/9, 2021 at 18:10
1
I created a "brands" collection and then added an index collation: { locale: "en", strength: 2} on the "title" field. But when I try to query it using this collation i...
Tamasha asked 14/7, 2021 at 9:39
3
Solved
I have a document with a structure similar to this
{
"brand": "BMW",
"models": ["320","545"]
}
Models must be unique, and I am using the following query when adding new items,
db.cars.update(...
Eleanor asked 30/1, 2014 at 19:58
4
Solved
I am using PyMongo to simply iterate over a Mongo collection, but I'm struggling with handling large Mongodb date objects.
For example, if I have some data in a collection that looks like this:
"...
Goins asked 6/11, 2018 at 18:10
3
Solved
I have a collection that looks like this:
{
"value" : "20",
"type" : "square",
"name" : "form1"
}
{
"value" : "24",
"type" : "circle",
"name" : "form2"
}
{
"value" : "12",
"type" : "square",
"nam...
Docker asked 8/11, 2018 at 15:5
4
Solved
REF: MongoDB Document from array with field value max
Answers in Finding highest value from sub-arrays in documents and MongoDB find by max value in array of documents suggest to use sort + limit(...
Fromm asked 21/1, 2019 at 14:41
2
I have a test data set (500k rows)
{
"_id": ObjectId("61309575c9346aab086f91fb"),
"listId": ObjectId("61309575c9346aab086f91fa"),
"createdDate"...
Loisloise asked 2/9, 2021 at 12:50
3
Solved
This should be a quick 2 minute find, but i'm searching for an hour and can't find any solution.
How can i capitalize first letter of each word of the username field?
{
"_id" : ObjectId("5908...
Cross asked 3/5, 2017 at 8:36
12
getting ReplicaSetNoPrimary and MongoServerSelectionError error while connecting MongoDB with nodejs
I am trying to connect to mongodb but getting below error could you please help
var mongo = require('mongodb').MongoClient;
mongo.connect('mongodb://usernamexyz:[email protected]:47017/sample...
Gurgitation asked 4/2, 2020 at 18:50
3
Solved
I want to test if "upsert" option for updating is woking fine. So I "upsert" an object into mongodb twice with same key. However it didn't show inserted message. Was I missing something ?
(mongodb...
Marje asked 3/11, 2014 at 5:0
6
Solved
Chatrooms.findOneAndUpdate({Roomname: room.Roomname},{ $setOnInsert: {status: true, userNum: 1}}, {new: true, upsert: true}, function(err, doc) {
if(err) console.log(err);
console.log("DOC " + d...
Shippen asked 27/8, 2015 at 22:36
6
Solved
Suppose I have a single document in my mongo collection that looks like this:
{
"_id": 123,
"field_to_prune":
{
"keep_field_1": "some value",
"random_field_1": "some value",
"keep_field_2":...
Chandos asked 18/10, 2013 at 21:8
18
Solved
I am interested in optimizing a "pagination" solution I'm working on with MongoDB. My problem is straight forward. I usually limit the number of documents returned using the limit() functionality. ...
Spessartite asked 15/2, 2014 at 20:33
17
Solved
I'm trying to insert an object into mongodb via a POST request. The object that I send gets inserted in the db successfully, however I get the error mentioned above.
The package I'm using for mongo...
Miquelon asked 15/12, 2020 at 12:28
1 Next >
© 2022 - 2024 — McMap. All rights reserved.