I wanted to delete certain set of documents in the mongo collection and insert new records, in case if the insert fails I want to rollback the delete. Basically, it is either both or none. Someone know what is the best approach for this. I'm using mo
I am upgrading my Ubuntu server and installing latest version of PHP i.e PHP 7.0.18, MongoDB 3.2.14, CodeIgniter v 2.2. Now when I am trying to connect with Mongo through CodeIgniter I am getting error as: The MongoDB PECL extension has not been inst
A little background. I am sending a post with the username. About what he came to me is displayed in the log. console.log(req.body.username); // 'username' How do I use mongodb to find and render a user with a username from the post? For example, the
I have two collections here : > db.Unit.find({}).limit(1).pretty() { "_id" : ObjectId("58b6878de1648d05903e1beb"), "number" : "07in15in4", "owner" : { "name" : "vacant" }, "floo
I'm creating a new schema in mongoose and trying to take input from user. I want that no duplicate entry is getting updated for serverIP, for that unique : true is added. But this is not working as expected and duplicates entries are getting through.
This question already has an answer here: How do I return the response from an asynchronous call? 31 answers Lately I have started experimenting with Node.js and Express.js. I am building a micro-application which takes in the data from Mongo Db and
I want to create current time as default value in a mongodb document if we didn't provide the value in insert statement. In mysql there is a provison for that by using the following statement. If we didn't insert the value, a default time value will
For the following schema (pseudo code). var Post = { title: "", content: "", date: new Date() } I want to return results grouped by month & year, so something like so, again psuedo code: [ { year: "2016", month: "4&q
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 to avoid duplicate values. Should I use db.collection
If I have the following document: { _id: 1, name: "Alto", color: "Red",cno: "H410",speed:40,mfdcountry: "India"} If i issue below two commands . What is the difference? Case1: db.car.findAndModify({ query: { name: &
I'm trying to implement application that get document from MongoDB and insert it to ElasticSearch. Here is a piece of code that should insert document to the ElasticSearch index: final Document o = (Document) document.get("o"); // this is where
I have a document like that: { "_id": ObjectId("55fa4615b70ad91c40069736"), "test": [ null, true ] } The "test" field is array with 2 elements. I want to count the number of array without null value use aggregate. I
Using autoform I saved the user's profile pic that they uploaded into the "images" collection. However I do not know how to call for that specific picture to be loaded on a template. The following does not display the image on the template. Howe
From my NodeJS program I connect to Mongodb with native driver. I start mongod and see server waiting for connections. When my program connects I can see however 5 connections instead of one. I don't understand why is happening as I do nothing unusua
For the following Json file, I have a mongodb query to select "Car" part of document only: db.collection.find({_item:"Home"}, {"Car":1, "_id":0}) How do I write this query in Powershell? { "_id" : 1, "
My collection contains the following two documents { "BornYear": 2000, "Type": "Zebra", "Owners": [ { "Name": "James Bond", "Phone": "007" } ] } { "BornYear": 2012,
I am trying to parse a mongodb query in json to dictionary and the JObject.Parse throws exception. The JSON string is something like below { vendor: "xyx", product: { $in : [ /prod1/i, /prod2/i, /prod3/i ] } } The exception is message is Error p
I just bring up Redhat 6.5 64-bit from AWS and did the below things: Disabled SELinux Disabled Iptables All ports opened in Security Group Rebooted Then i just followed, both of the below instructions: http://docs.mongodb.org/manual/tutorial/install-
This seems really poorly documented.. The documentation example just has callback being passed to update. There is a link redirecting to Model.update here and the example shows the parameters of the callback are (err, numberAffected, raw). Does the D
After a mongoose request I have my document doc which is the result of the query Here is the schema used var searchSchema = new mongoose.Schema({ original : String, images : [String], image: String }); The model : var searchModel = mongoose.model('Se
With .post of FORM data to express/node.js All of the values are currently stored and returned as STRings Am looking to have one of the data values (req.body.quantity) stored as an INT //POST app.post('/add', function (req, res) { db.collection('demo
I´m looping through an array and I want each part of the array to be displayed in my browser. While it finds the right entries and puts them in the console it won´t show them in the browser. I can make the first one or last one appear on the screen b
I am just getting familiar with MongoDB and its my first time to use it. I am using Ubuntu enviornment for the development. I installed the MongoDB as per the instructions mentioned in the tutorial available on the MongoDb website. They said that the
I have a a table on filemaker that has about 1 million + rows and growing. It has about 30 columns. I need to display this on to the datatables on my PHP page. My research online says FileMaker to PHP is super slow. So, i am trying to get the data to
I have a simple collection populated with student data and I need to remove some records based on some parameters. I executed the following from mongoshell for(i=0;i<200;i++) { var rec = db.grades.find({student_id:i,type:'homework'}).sort({score:1}).
I'm currently working on a RESTful API using Symfony2 with FOSRestBundle. I love Mongodb, so i've implemented just that, here is a snippet of my usercontroller. /** * @return View view instance * @View() */ public function allAction() { $users = $thi
Assuming I have a collection called "posts" (in reality it is a more complex collection, posts is too simple) with the following structure: > db.posts.find() { "id" : ObjectId("50ad8d451d41c8fc58000003"), "title"
Here is my class: class Presentation(db.Document): title = db.StringField(max_length=120, required=True) author = db.StringField (required=True) pages = db.DocumentField(Page, required=False) tags = db.StringField(max_length=120, required=False) id =
Can you please give me an database design suggestion? I want to sell tickets for events but the problem is that the database can become bootleneck when many user what to buy simultaneously tickets for the same event. if I have an counter for tickets
I have been following along with Rob Conery's Linq for MongoDB and have come across a question. In the example he shows how you can easily nest a child object. For my current experiment I have the following structure. class Content { ... Profile Prof