1

I'm using MongoDB with PHP's own driver and I have saved multiple arrays under main document. Structure looks like this:

[
  {
    _id: 5,
    unique: true,
    name: "Joseph",
    password: "mangalore"
  },
  {
    _id: 9,
    unique: true,
    name: "John",
    password: {
      passcode1: 1,
      passcode2: 2
    }
  }
]

Note: I want to fetch the data where passcode2 > 1

Note: Can u please show me both php and laravel code

My code is

$id = DB::connection('mongodb')
     ->collection('login2')
     ->where(array('password.passcode2','>',2))
     ->get();       

return $id;
0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.