mongodb-query Questions

10

How to create a date field with default value,the default value should be current timestamps whenever the insertion happened in the collection.
Marxismleninism asked 11/4, 2016 at 13:33

0

we have a grid and there have multiple columns in the grid like product name,product details ,product id etc. all other fields working fine with partial contains search But have issue with objectid...
Eckart asked 17/12, 2022 at 15:47

2

Solved

I'm hoping that someone might be able to answer whether what I'm trying to accomplish below can be done with the MongoDB Aggregation Framework. I have a user data structure that resembles the foll...
Smolt asked 28/2, 2014 at 23:29

12

Solved

In MongoDB, is it possible to update the value of a field using the value from another field? The equivalent SQL would be something like: UPDATE Person SET Name = FirstName + ' ' + LastName And ...
Prenotion asked 20/10, 2010 at 5:22

10

Solved

I have a NodeJS application with Mongoose ODM(Mongoose 3.3.1). I want to retrieve all fields except 1 from my collection.For Example: I have a collection Product Which have 6 fields,I want to selec...
Satsuma asked 28/1, 2013 at 9:40

3

Last time I get alert from MongoDB Atlas: Disk I/O % utilization on Data Partition has gone above 70 on nvme2n1 But I have no any ideas how can I localize / query / index / part of code / probl...

2

Solved

I have a MongoDB that I use with python. My entries that looks as follows: { a: something b: something c: { d: something e: something f: something } } I want to query for entries that hav...
Eupatrid asked 17/7, 2017 at 7:16

4

Solved

I have two collections User { "_id" : ObjectId("584aac38686860d502929b8b"), "name" : "John" } Role { "_id" : ObjectId("584aaca6686860d502929b8d"), "role" : "Admin", "userId" : "584aac3868...
Impresa asked 12/12, 2016 at 3:7

11

Solved

I know that MongoDB supports the syntax find{array.0.field:"value"}, but I specifically want to do this for the last element in the array, which means I don't know the index. Is there some kind of ...
Refutative asked 23/2, 2015 at 18:3

5

Solved

It seems to me that when you are creating a Mongo document and have a field {key: value} which is sometimes not going to have a value, you have two options: Write {key: null} i.e. write null valu...
Headliner asked 13/9, 2012 at 9:27

18

Solved

{ name: 'book', tags: { words: ['abc','123'], lat: 33, long: 22 } } Suppose this is a document. How do I remove "words" completely from all the documents in this collection? I want all doc...
Electronegative asked 27/7, 2011 at 22:17

8

Solved

Is there a super UNIX like "root" user for MongoDB? I've been looking at http://docs.mongodb.org/manual/reference/user-privileges/ and have tried many combinations, but they all seem to lack in an ...
Batchelor asked 21/11, 2013 at 9:32

4

Solved

I have a deeply nested collection in my MongoDB collection. When I run the following query: db.countries.findOne({},{'data.country.neighbor.name':1,'_id':0}) I end up with this nested result h...
Polis asked 8/11, 2012 at 2:56

5

Solved

I have tried the following steps to install and setup mongodb in my mac from here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ but I got the following error when running the fi...
Casablanca asked 25/2, 2021 at 20:6

5

I have a document like { "_id": ObjectId('56a77bfae0ce9f6a738cb2b7'), "nameIdentity": [ { "givenNameOne": "LATANYA", "givenNameThree": "BIZOR", "lastName": "BIZOR", "sourceReferenceId": [ ...
Flatwise asked 27/1, 2016 at 8:38

6

Solved

I am newbie to mongodb. I need to insert a doc without the _id field generating automatically. I need to set the field Tenant_id as unique or need to change the "_id" field to Tenant_id. how to...
Caitlin asked 11/9, 2012 at 21:40

4

Solved

When I am firing this query on MongoDB, I am getting all the places in the proximity of 500 miles to the specified co-ordinates. But I want to know the exact distance between the specified co-ordin...
Tejeda asked 23/11, 2015 at 5:49

4

Solved

I want to export very large collections and import them into another database in another server. I found there are at least two ways: mongoexport and mongodump. I searched previous posts abou...
Median asked 3/9, 2020 at 8:37

10

Solved

Every day, I receive a stock of documents (an update). What I want to do is insert each item that does not already exist. I also want to keep track of the first time I inserted them, and the last...
Selfimportant asked 10/5, 2010 at 7:33

3

Solved

I have a collection with a location field that was entered in the wrong order: location: [38.7633698, -121.2697997] When I try to place a 2d index on the field using ... db.collection.ensureInd...
Sills asked 26/2, 2014 at 21:41

4

The question about the way to get a random document from collection has been asked many times and there were suggestions on this topic. What I need is to get several random documents from collect...
Keen asked 17/12, 2012 at 8:38

30

I am looking to get a random record from a huge collection (100 million records). What is the fastest and most efficient way to do so? The data is already there and there are no field in which I ca...
Viceregent asked 13/5, 2010 at 2:43

6

Solved

Let us have a MongoDB collection which has three docs.. db.collection.find() { _id:'...', user: 'A', title: 'Physics', Bank: 'Bank_A' } { _id:'...', user: 'A', title: 'Chemistry', Bank: 'Bank_B...
Profusion asked 9/6, 2014 at 14:56

5

Solved

I am trying to calculate total value if that value exits. But query is not working 100%. So can somebody help me to solve this problem. Here my sample document. I have attached two documents. Pleas...
Parthenope asked 26/3, 2018 at 12:14

9

Solved

I have the following code: connection((db) => { db.collection('orders') .updateOne( { "_id": req.body._id}, // Filter {"name": req.body.name} // Update ) .then((obj) => { console.log...
Err asked 5/12, 2017 at 14:54

© 2022 - 2024 — McMap. All rights reserved.