Tagged Questions
0
votes
0answers
10 views
YAML to DB CRUD with PHP?
I want to have a simple form with PHP that takes YAML code as an input and stores it in to MongoDB when submitted. The update of records should also happen in the same way with editing yaml codes.
I ...
0
votes
3answers
35 views
Mongodb php compound query returns nothing
I have the following array:
Array
(
[data.cars] => 44
[data.xp] => Array
(
[$gte] => 100
[$lte] => 500
)
[data.money] => Array
...
2
votes
1answer
83 views
+100
MongoDB Cross-db DBRef's in 2.4
I'm running MongoDB 2.4.6 locally and the MongoDB PECL extension is 1.4.3 while testing this.
I'm currently working on an app that has two MongoDB databases, one called nc_main with a collection ...
0
votes
2answers
28 views
How to run multiple linux command using PHP
is it possible to run multiple linux command using PHP. I am using Mongodb database and if I want to import multiple collections, I am running the following command for each collection individually.
...
-1
votes
1answer
22 views
MongoDb replacing a document and inserting when non-existant
I want to replace a document when this already exists and if it doesn't I want it inserted.
How can I do that in mongoDb?
I need something like this, but in one query:
find by a "where statement"
...
0
votes
1answer
20 views
missing value on upsert of an embedded array
I am playing with mongodb (2.4.7 64bit Linux OS) to figure out if it would be a great replacement for a existing mysql database. Pretty neat is the upsert functionallity - but I have a problem here. ...
-1
votes
1answer
37 views
How do I using Mongo aggregation to get the total “page views” for each group of days
I have tried for a few days now to come up with a working aggregate but I'm just not getting it.
I have a collection that looks similar to the following.
_id: ObjectId("52672ca368a56f481d000045"),
...
0
votes
1answer
38 views
MongoDB update query where field name has a DOT (period) in it
So before I ask the question I want to say I do know that Mongo doesn't allow period i.e dot (.) in the field name.
The surprising part is that PHP was able to insert data to mongo with period in it ...
1
vote
0answers
35 views
Maximum size of MongoDB insert
I'm inserting a document in Mongo from PHP.
I get the following error
Uncaught exception 'MongoException' with message 'insert too large: 16458711, max: 16000000'
But the Mongo documentation says ...
0
votes
3answers
29 views
Multiple push with reduce() in PHP MongoCollection->group()
I need to understand a MongoCollection->group() feature. PHP manual for group() states what follows:
<?php
$collection->insert(array("category" => "fruit", "name" => "apple"));
...
0
votes
1answer
43 views
Algorithm for optimising compound index search in MongoDb
I have a collection X on which I have to apply a filter.
The filter is saved as a sepparate entity (collection filters) and the only data it holds are the field name and the conditions applied to ...
1
vote
1answer
119 views
Mongo+PHP Querying nested (embedded) documents excluding fields +'Where' clause
Trying to query nested documents(message collection) with embedded fields from an other collection(user)
here it is an example of the document i want to query:
array (
'_id' => new ...
0
votes
1answer
39 views
MongoDB - PHP manual references approach suitability
MongoDB newbie here. I'm having the first approach on references, and my main doubt is if i'am using the appropriate strategy(manual references) for my situation.
Working on 2 collections(user, ...
0
votes
1answer
114 views
Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/mongo.so
I am new to mongodb. I just installed mongodb on our development (linux) server:
I got mongodb to work on my console and I could load and save data, but when I wanted to install the PHP driver and ...
0
votes
2answers
56 views
MongoDB running command in lithium
I'm trying to run a full text search against some data that is stored in mongoDb using Lithium.
Here is how I am trying to do it in my controller:
$mongodb = ...
0
votes
2answers
128 views
Mongodb query specific month|year not date
How can I query a specific month in mongodb, not date range, I neeed month to make a list of customer birthday for current month.
In SQL will be something like that:
SELECT * FROM customer WHERE ...
0
votes
1answer
34 views
how to do multiple where with same field?
How to convert this script for mongoDB?
select * from table where id > -1 and id in (4,5)
I need to execute this query with two where conditions on the same field.
This doesn't seem to work in ...
0
votes
1answer
35 views
Does the mongodb php driver require php5-dev?
I'm trying to install mongodb in a PHP environment. MongoDB itself is installed fine, I've run pecl install mongo, and added extension=mongo.so to php.ini; but my Laravel application complains that it ...
0
votes
0answers
44 views
MongoDB shard with PHP mongdb driver for storing session is slow, why?
My company uses Php with php mongo driver connecting to a sharded (5) mongo DB. The main thing it does is to store web session. So there is lots of write.
The shard key is the session id which is ...
0
votes
1answer
116 views
MongoDB UTF-8 matching
I'm using mongoDB and I'm using turkish alphabet.
But when I try to match turkish characters, there is a problem.
an example:
my database includes these values: İngiltere, İtalya, Şampiyona.
when I ...
0
votes
2answers
88 views
Reading data with .NET inserted to MongoDB with PHP
I have an unusual setup where I am inserting data into a MongoDB from a PHP site. The data is then read by .NET and served up as an API.
After inserting a record (via PHP) the .NET API throws the ...
0
votes
1answer
20 views
how to query by values in MongoDB [closed]
My collection looks like:
{
"_id" : ObjectId("520c8976586f12c80900301d"),
"IDENTITY" : "ae4ff1546ecfe6ce6e8ebb2d870d57fb",
"NAME" : "Winmain Yao",
"TYPE" : "COMPANY",
"PUBLIC" : 1,
"BACKGROUND" : ...
0
votes
0answers
42 views
MongoDB: $unset replaces with null?
I have an array stored in my document:
"properties" : [
{
"createdate" : 1375981035,
"updated" : 1375981035
},
{
...
0
votes
1answer
111 views
Mongodb aggrgation function for sum of embedded documents not working
i get an error like
Array
(
[errmsg] => exception: the $unwind field path must be specified as a string
[code] => 15981
[ok] => 0
)
While i used following query for given ...
0
votes
1answer
53 views
MongoCursor Positioning Infinite Scroll Application with PHP
I am needing to get an infinite scrolling REST API call going. I have a general approach, but I cannot seem to find the proper syntax for what I am trying to accomplish. Essentially, the Web-App ...
0
votes
3answers
50 views
Combining '$or' and daterange
I'm getting the following fault while trying to combine '$or' with date range using the MongoDB PHP Driver:
Fatal error: Uncaught exception 'MongoCursorException' with message '$and/$or/$nor must be a ...
0
votes
2answers
31 views
Incorrect sort result when using $nearSphere
this sorted correctly when using directly
db.users.find({currentloc : {$nearSphere : [115.22804,-8.69914]}})
but when execute from PHP, it look like sorted by _id
$users = ...
0
votes
3answers
102 views
Querying sub array with $where
I have a collection with following document:
{
"_id" : ObjectId("51f1fd2b8188d3117c6da352"),
"cust_id" : "abc1234",
"ord_date" : ISODate("2012-10-03T18:30:00Z"),
"status" : "A",
"price" : 27,
"items" ...
0
votes
1answer
104 views
PHPUnit Mock of MongoCollection class creating a _PHP_Incomplete_Class object
Today I came back to a project I have not touched for a while. It is a Zend Framework 2 project using MongoDB as its database.
I decided since it had been a while to update MongoDB to the latest ...
0
votes
1answer
321 views
php & mongodb: using $addToSet w/ $each
This question is very similar to mine: Is there a way to check if one of the array entries contains a sub-array in MongoDB?
However, in mine, i'm still getting problems with some updates.
I'm getting ...
1
vote
2answers
45 views
MongoDB (this OR that OR the other) but NOT (me)
I have an account document that looks like this:
_id: ###
email: string
password: md5(string)
altemail: [{ email: string
verified: time},
{ email: string
...
0
votes
1answer
52 views
MongoDB: If document exists VS If document does not exist
I'm a beginner at MongoDB and I'm currently pairing it with php to try to make the following work:
I want to create a database to store information that can get updated at any time but it needs to ...
2
votes
0answers
1k views
Laravel 4 & MongoDB [closed]
I'm a Laravel's fan. Php generally & Laravel individually is a good combination with MySql. However, I have recently been interested in MongoDB's flexibility & simplicity. I want to refer ...
0
votes
2answers
81 views
Mongodb elemMatch alex bilbie library
i am using alex bilbie library for mongo db (https://github.com/alexbilbie/codeigniter-mongodb-library/tree/v2). I dont know how to form elemMatch query with this lib.
I need to transform this to ...
0
votes
1answer
209 views
Issue with boolean query in mongo php
I need to perform a query based on the value of some boolean fields. These fields may not exist in some documents, as they were added at a later stage.
I tested the query in the shell and worked ok:
...
0
votes
2answers
174 views
How can I add/insert to a subdocument array in CakePHP?
Ok, so I have done alot of searches on this site and Google and found some answers, but none of it has worked. I also have checked out @ichikaway's site and test procedures. Even the thing in there ...
1
vote
2answers
256 views
Mongodb update several documents with different values
i am trying to update several documents in mongodb with different values each.
In mysql I do something like this:
$objs = ...
0
votes
1answer
38 views
MongoDB keeps giving me null
I have some difficulty in getting Mongodb aggregate to work. It keeps giving me null. Please help. Below are the codes written in php. Thanks.
What I want to do is to sum up the values of 2 fields, ...
0
votes
0answers
110 views
mongodb php driver installation issue in redhat.
My server Os is redhat. I installed mongodb 2.2.3 version successfully in my server. i used this link for reference ...
0
votes
1answer
93 views
Locking in MongoDB for a Pintrest like website
One of our client projects is a Pinterest like website. It was made with MySQL and CodeIgniter some time back. As they have recently gotten funding and hopefully will get a lot more traffic. We are ...
0
votes
1answer
35 views
Expiring elements inside mongodb document
Note: First time using MongoDB.
Technology: php mongodb
Scenario:
The data is suppose to hold programs offered. Document looks like:
{
LocationName: 'name of the location',
LocationAddress: ...
0
votes
1answer
221 views
Slow (high latency) upon queries with sort mongoDB
I am currently migrating from couchdb to mongodb, still learning this stuff and have a problem anytime I do some queries with sorting in my webpage.
I am using codeigniter as the framework and using ...
-1
votes
4answers
79 views
Server-side Framework/Language for MongoDB
If MySQL walks hand-in-hand with PHP, what is the equivalent of the MongoDB? Is there any framework that works efficiently and matured with MongoDB?
0
votes
1answer
179 views
MongoCollection::aggregate() is undefined in Heroku PHP using MongoHQ
I'm getting the following error when using MongoDB's aggregate() function in a PHP code. This code perfectly works on my local setup which is running MongoDB 2.2.3
PHP Fatal error: Call to undefined ...
0
votes
0answers
94 views
MongoDB Intermittent Error
I have a random error that I can't duplicate on command but happens about 10-20 times a day. We have the database server separate from our Web Application.
Any idea what could be causing this? I'm ...
2
votes
1answer
364 views
Query With Projection In MongoDB, PHP Syntax?
What is the php syntax which will do the work which the following mongodb Shell does?
> db.SoManySins.find({},{"_id":0,"FactoryCapacity":1})
0
votes
2answers
559 views
How to update embedded document in MongoDB with Doctrine ODM
I'm unable to find how to update embedded documents with Doctrine Mongo ODM in Symfony2. I have a class called Page with many embedded documents "Comments" and I want to use createQueryBuilder to ...
1
vote
0answers
116 views
Mongodb PHP driver : MongoCursorException
I had decided to upgrade mongo in version 2.4.0.
I use the php driver in his last version, but now when I do a batchInsert() sometime i have this error :
PHP Fatal error: Uncaught exception ...
1
vote
1answer
56 views
API Caching and Searching
I'm creating a product (in php) that works off of calling an api to pull information needed, I want to cache/save these results into mongodb based off of the query strings used, so that the next call ...
1
vote
1answer
154 views
Attempting to use index type '-1' where index types are not allowed (1 or -1 only)
I am using:
$db->collection->find()->sort(array('username' => '-1'));
And I keep getting the error:
MongoCursorException: localhost:27017: Attempting to use index type
'-1' where ...