Skip to content
Advertisement

Tag: mongodb

Properly parse a Mongo cursor to PHP

When converting a MongoCursor to PHP I use this script. Which was presented here StackOverflowSO using the upper method, the structure is same but _id is whereas using the lower script which yields the below included result. Unfortunately, this results in the actual object being embedded into an array with the _id from Mongo. Like this : Since I am

Purpose of Secondary Key

What is the purpose of the Secondary key? Say I have a table that logs down all the check-ins (similar to Foursquare), with columns id, user_id, location_id, post, time, and there can be millions of rows, many people have stated to use secondary keys to speed up the process. Why does this work? And should both user_id and location_id be

Advertisement